fork download
  1. #include<iostream>
  2. #include<string.h>
  3. using namespace std;
  4. int main(void)
  5. {
  6. char *strings[30];
  7. char *strings1[30];
  8. char Policystr[4096] ;
  9. char delims[] = " ";
  10. cin.getline(Policystr,2016);
  11. int i = 0;
  12. strings[i] = strtok( Policystr, delims );
  13. while( strings[i] != NULL )
  14. {
  15. //printf("%d '%s'\n", i, strings[i]);
  16. strings[++i] = strtok( NULL, delims );
  17. }
  18. char pol[4096];
  19. cin.getline(pol,2016);
  20. int j=0;
  21. while(strings1[j]!= NULL){
  22. strings1[++j] = strtok(NULL,delims);
  23. }
  24. int m = 0;
  25. for(int k=0;k<=j;k++){
  26. if(strings1[k][0] == '%'&&strings1[k][2] == '['){
  27. if(strings1[k][4] == ']'){
  28. if(strings1[k][5] == ':'){
  29. strings1[k].replace(0,strings1[k].length(),string1[strings[k][3]].substring(0,strings1[k][6]));
  30. }
  31. else{
  32. strings1[k].replace(0,strings1[k].length(),string1[strings[k][3]);
  33. }
  34. }
  35.  
  36. }
  37. else if(strings1[k][0] == '%'&&strings1[k][3]==-1){
  38. continue;
  39. }
  40. else if(strings1[k][0] == '%'){
  41. strings1[k].replace(0,strings1[k].length,string1[m++]);
  42. }
  43. }
  44.  
  45. for(int o=0;o<=j;o++){
  46. cout<<strings1[o]<<" ";
  47. }
  48.  
  49. }
Compilation error #stdin compilation error #stdout 0s 3472KB
stdin
acbbkas ,ahsdka kahdakd jhsadkadb
compilation info
prog.cpp: In function 'int main()':
prog.cpp:29:21: error: request for member 'replace' in 'strings1[k]', which is of non-class type 'char*'
         strings1[k].replace(0,strings1[k].length(),string1[strings[k][3]].substring(0,strings1[k][6]));
                     ^
prog.cpp:29:43: error: request for member 'length' in 'strings1[k]', which is of non-class type 'char*'
         strings1[k].replace(0,strings1[k].length(),string1[strings[k][3]].substring(0,strings1[k][6]));
                                           ^
prog.cpp:29:52: error: 'string1' was not declared in this scope
         strings1[k].replace(0,strings1[k].length(),string1[strings[k][3]].substring(0,strings1[k][6]));
                                                    ^
prog.cpp:32:21: error: request for member 'replace' in 'strings1[k]', which is of non-class type 'char*'
         strings1[k].replace(0,strings1[k].length(),string1[strings[k][3]);
                     ^
prog.cpp:32:43: error: request for member 'length' in 'strings1[k]', which is of non-class type 'char*'
         strings1[k].replace(0,strings1[k].length(),string1[strings[k][3]);
                                           ^
prog.cpp:32:52: error: 'string1' was not declared in this scope
         strings1[k].replace(0,strings1[k].length(),string1[strings[k][3]);
                                                    ^
prog.cpp:32:73: error: expected ']' before ')' token
         strings1[k].replace(0,strings1[k].length(),string1[strings[k][3]);
                                                                         ^
prog.cpp:41:19: error: request for member 'replace' in 'strings1[k]', which is of non-class type 'char*'
       strings1[k].replace(0,strings1[k].length,string1[m++]);
                   ^
prog.cpp:41:41: error: request for member 'length' in 'strings1[k]', which is of non-class type 'char*'
       strings1[k].replace(0,strings1[k].length,string1[m++]);
                                         ^
prog.cpp:41:48: error: 'string1' was not declared in this scope
       strings1[k].replace(0,strings1[k].length,string1[m++]);
                                                ^
stdout
Standard output is empty