首页 > 代码库 > 【网易】 【作业】 程序设计入门—C语言 翁恺 第二周

【网易】 【作业】 程序设计入门—C语言 翁恺 第二周

#include<stdio.h>
int main()
{
    int a=0,b=0;
    scanf("%d",&a);
    if(a>=800)
    {
                b=a-800; 
                    printf("%d",b);
                  
    }
    else{ 
                  printf("%d",b=2400+a-800);
    }
    system("pause");
}    
#include<stdio.h>
int main()
{
    int a=0,x=0,y=0;
    scanf("%d",&a);
    x=a/10,y=a%10;
    switch (y){
           case 1:
                switch (x){
                       case 1:printf("Faint signals, barely perceptible, unreadable.");break;
                       case 2:printf("Faint signals, barely perceptible, barely readable, occasional words distinguishable.");break;
                       case 3:printf("Faint signals, barely perceptible, readable with considerable difficulty.");break;
                       case 4:printf("Faint signals, barely perceptible, Readable with practically no difficulty.");break;
                       case 5:printf("Faint signals, barely perceptible, perfectly readable.");break;
                       };break;
            case 2:
                switch (x){
                       case 1:printf("Very weak signals, unreadable.");break;
                       case 2:printf("Very weak signals, barely readable, occasional words distinguishable.");break;
                       case 3:printf("Very weak signals, readable with considerable difficulty.");break;
                       case 4:printf("Very weak signals, Readable with practically no difficulty.");break;
                       case 5:printf("Very weak signals, perfectly readable.");break;
                       };break;
            case 3:
                switch (x){
                       case 1:printf("Weak signals, unreadable.");break;
                       case 2:printf("Weak signals, barely readable, occasional words distinguishable.");break;
                       case 3:printf("Weak signals, readable with considerable difficulty.");break;
                       case 4:printf("Weak signals, Readable with practically no difficulty.");break;
                       case 5:printf("Weak signals, perfectly readable.");break;
                       };break;
            case 4:
                switch (x){
                       case 1:printf("Fair signals, unreadable.");break;
                       case 2:printf("Fair signals, barely readable, occasional words distinguishable.");break;
                       case 3:printf("Fair signals, readable with considerable difficulty.");break;
                       case 4:printf("Fair signals, Readable with practically no difficulty.");break;
                       case 5:printf("Fair signals, perfectly readable.");break;
                       };break;
            case 5:
                switch (x){
                       case 1:printf("Fairly good signals, unreadable.");break;
                       case 2:printf("Fairly good signals, barely readable, occasional words distinguishable.");break;
                       case 3:printf("Fairly good signals, readable with considerable difficulty.");break;
                       case 4:printf("Fairly good signals, Readable with practically no difficulty.");break;
                       case 5:printf("Fairly good signals, perfectly readable.");break;
                       };break;            
            case 6:
                switch (x){
                       case 1:printf("Good signals, unreadable.");break;
                       case 2:printf("Good signals, barely readable, occasional words distinguishable.");break;
                       case 3:printf("Good signals, readable with considerable difficulty.");break;
                       case 4:printf("Good signals, Readable with practically no difficulty.");break;
                       case 5:printf("Good signals, perfectly readable.");break;
                       };break;
            case 7:
                switch (x){
                       case 1:printf("Moderately strong signals, unreadable.");break;
                       case 2:printf("Moderately strong signals, barely readable, occasional words distinguishable.");break;
                       case 3:printf("Moderately strong signals, readable with considerable difficulty.");break;
                       case 4:printf("Moderately strong signals, Readable with practically no difficulty.");break;
                       case 5:printf("Moderately strong signals, perfectly readable.");break;
                       };break;
            case 8:
                switch (x){
                       case 1:printf("Strong signals, unreadable.");break;
                       case 2:printf("Strong signals, barely readable, occasional words distinguishable.");break;
                       case 3:printf("Strong signals, readable with considerable difficulty.");break;
                       case 4:printf("Strong signals, Readable with practically no difficulty.");break;
                       case 5:printf("Strong signals, perfectly readable.");break;
                       };break;
            case 9:
                switch (x){
                       case 1:printf("Extremely strong signals, unreadable.");break;
                       case 2:printf("Extremely strong signals, barely readable, occasional words distinguishable.");break;
                       case 3:printf("Extremely strong signals, readable with considerable difficulty.");break;
                       case 4:printf("Extremely strong signals, Readable with practically no difficulty.");break;
                       case 5:printf("Extremely strong signals, perfectly readable.");break;
                       };break;           
                       }
      system("pause");
}                      
                       

 

【网易】 【作业】 程序设计入门—C语言 翁恺 第二周