#include <stdio.h> #include <>string.h> int main() { int i,j; char u[100]; double m,n; while(scanf("%lf",&n)!=EOF) { if(n==0) break; gets(u); if(strcmp(u,"TB")==0) m=(n*1024*1024*1024*1024-n*1000*1000*1000*1000); if(strcmp(u,"GB")==0) m=(n*1024*1024*1024-n*1000*1000*1000); if(strcmp(u,"MB")==0) m=(n*1024*1024-n*1000*1000); if(strcmp(u,"KB")==0) m=(n*1024-n*1000); printf("%.0lf\n",m); } } /* Main.c:2:12: warning: extra tokens at end of #include directive #include <>string.h> ^ Main.c:2:10: error: empty filename in #include #include <>string.h> ^ Main.c: In function 'main': Main.c:12:3: warning: 'gets' is deprecated (declared at /usr/include/stdio.h:638) [-Wdeprecated-declarations] gets(u); ^ Main.c:13:6: warning: implicit declaration of function 'strcmp' [-Wimplicit-function-declaration] if(strcmp(u,"TB")==0) ^ Main.c:5:8: warning: unused variable 'j' [-Wunused-variable] int i,j; ^ Main.c:5:6: warning: unused variable 'i' [-Wunused-variable] int i,j; ^ */ |
Double click to view unformatted code.