fork download
  1. #include <iostream>
  2. #include<string.h>
  3. #include<stdlib.h>
  4. using namespace std;
  5. void reversestring(char *str,int beg,int end){
  6. char temp;
  7. while(beg<end){
  8. temp=str[beg];
  9. str[beg]=str[end];
  10. str[end]=temp;
  11. beg++;
  12. end--;
  13. }
  14.  
  15. }
  16. void reversingwords(char *str,int sbeg,int send){
  17. int i,beg,end;
  18. reversestring(str,sbeg,send);
  19. beg=0;
  20. for(i=sbeg;i<send;i++){
  21. if(str[i]==' '){
  22. end=i-1;
  23. reversestring(str,beg,end);
  24. beg=i+1;
  25. }
  26. }
  27.  
  28. }
  29.  
  30. int main() {
  31. char arr[100];
  32. int q;
  33. printf("%d", scanf("%s%d", arr,q));
  34. char p[100]="sort the elements in array";
  35. int n=strlen(p);
  36. reversingwords(p,0,n);
  37. for(int i=0;i<=n;i++)
  38. cout<<p[i];
  39. return 0;
  40. }
  41.  
  42.  
  43.  
Compilation error #stdin compilation error #stdout 0s 3096KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:33:37: error: 'scanf' was not declared in this scope
     printf("%d", scanf("%s%d", arr,q));
                                     ^
prog.cpp:33:38: error: 'printf' was not declared in this scope
     printf("%d", scanf("%s%d", arr,q));
                                      ^
stdout
Standard output is empty