Last active
October 31, 2016 04:13
-
-
Save FloydHsiu/94c5c029d8e304820372661b8e402d4f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int main() | |
{ | |
int N; | |
double input; | |
printf("學號後五碼:30023\n"); | |
printf("Enter a number:"); | |
scanf("%lf",&N); //讀double要用%lf | |
fflush(stdin); | |
if(N>=-50 && N<=50) | |
{ | |
printf("輸入運算符號:"); | |
scanf("%c",&input); | |
switch(input) | |
{ | |
case'+': | |
printf("30023+%lf=%lf",N,30023+N); | |
break; | |
case'-': | |
printf("30023-%lf=%lf",N,30023-N); | |
break; | |
case'*': | |
printf("30023*%lf=%lf",N,30023*N); | |
break; | |
case'/': | |
printf("30023/%lf=%lf",N,30023/N); | |
break; | |
} | |
} | |
else printf("error"); | |
printf("\n"); | |
system("pause"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment