#include<stdio.h> #include<string.h> using namespace std; int main(){ char a[100],b[100]; int l,k=0; while(gets(a)!=NULL){ l=strlen(a); for(int i=0;i<=l;i++){ if(a[i]!=' '&&a[i]!='\0'){ b[k]=a[i]; k++; } else if(a[i]==' '){ for(int j=k-1;j>=0;j--){ printf("%c",b[j]); } printf(" "); k=0; } else if(a[i]=='\0'){ for(int j=k-1;j>=0;j--){ printf("%c",b[j]); } k=0; printf("\n"); } } } } /* Main.c:3:1: error: unknown type name 'using' using namespace std; ^ Main.c:3:17: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'std' using namespace std; ^ Main.c: In function 'main': Main.c:7:2: warning: 'gets' is deprecated (declared at /usr/include/stdio.h:638) [-Wdeprecated-declarations] while(gets(a)!=NULL){ ^ */ |
Double click to view unformatted code.