依旧模仿



#include <stdio.h>
#include <stdlib.h>

int main()
{
    int week;
    scanf("%d",&week);
    switch(week)
    {
        case 0:printf("sunday\n");break;
        case 1:printf("monday\n");break;
        case 2:printf("tuesday\n");break;
        case 3:printf("wednesday\n");break;
        case 4:printf("thursday\n");break;
        case 5:printf("friday\n");break;
        case 6:printf("saturday\n");break;
        default:printf("error\n");
    }
    return 0;
}



#include <stdio.h>
#include <stdlib.h>

int main()
{
    float a,b;
    char c;
    printf("please enter a,b and op:");
    scanf("%f%c%f",&a,&c,&b);
    switch(c)
    {
        case '+':printf("%f+%f=%f\n",a,b,a+b);break;
        case '-':printf("%f-%f=%f\n",a,b,a-b);break;
        case '*':printf("%f*%f=%f\n",a,b,a*b);break;
        case '/':if(b!=0.0)
                  {
                      printf("%f/%f=5f\n",a,b,a/b);break;
                  }
        default:printf("error");
    }
    return 0;
}

你可能感兴趣的:(依旧模仿)