#include<stdio.h> #include<math.h> int main(){ char str1[100],str2[100]; int i,j,word=0; gets(str1); for(i=0;str1[i]!='\0';i++'){ if(str1[i]>='0'&&str1[i]<='0'){ str2[j++]=str1[i]; word=0; } else { if(word==0){ str2[j++]='*'; word=1; } } } puts(str2); return 0; } /* Main.c: In function 'main': Main.c:6:2: warning: 'gets' is deprecated (declared at /usr/include/stdio.h:638) [-Wdeprecated-declarations] gets(str1); ^ Main.c:7:28: warning: missing terminating ' character for(i=0;str1[i]!='\0';i++'){ ^ Main.c:7:3: error: missing terminating ' character for(i=0;str1[i]!='\0';i++'){ ^ Main.c:8:5: error: expected ')' before 'if' if(str1[i]>='0'&&str1[i]<='0'){ ^ Main.c:18:3: error: expected expression before '}' token } ^ Main.c:5:10: warning: unused variable 'word' [-Wunused-variable] int i,j,word=0; ^ Main.c:5:8: warning: unused variable 'j' [-Wunused-variable] int i,j,word=0; ^ Main.c:4:17: warning: unused variable 'str2' [-Wunused-variable] char str1[100],str2[100]; ^ Main.c: At top level: Main.c:19:3: warning: data definition has no type or storage class puts(str2); ^ Main.c:19:3: warning: type defaults to 'int' in declaration of 'puts' Main.c:19:3: warning: parameter names (without types) in function declaration Main.c:20:7: error: expected identifier or '(' before 'return' return 0; ^ Main.c:21:1: error: expected identifier or '(' before '}' token } ^ */ |
Double click to view unformatted code.