fork download
  1. #include <iostream>
  2.  
  3. #include <cctype>
  4. #include <cstring>
  5.  
  6. //Function 1
  7. void upgrade(int &acr)
  8. { acr=9; cout<<"\n\n>Successfully updated the file."; getch(); }
  9.  
  10.  
  11. //Function 2
  12. void search(char ch[160],char acronym[9][36],int acr)
  13. { int count,c=strlen(ch);
  14. for(int i=0;i<acr;i++)
  15. {
  16. for(int j=0;acronym[i][j]!='=';j++);
  17. for(int k=0;k<=c;k++)
  18. { for(int l=0,count=0;l<j;l++)
  19. if(toupper(ch[k+l])==acronym[i][l]) count++;
  20. if(count==j) {cout<<'\n'<<acronym[i]; break;}
  21. }
  22. }
  23. }
  24.  
  25.  
  26. //Function 3
  27. void display (char ch[160], char acronym[9][36],int acr)
  28. { int i,j,k,l,count,p;
  29. for(i=0;i<=strlen(ch);i++)
  30. { for(j=0;j<acr;j++)
  31. { for(l=0;acronym[j][l]!='=';l++);
  32. for(k=0,count=0,p=0;k<l;k++)
  33. if(toupper(ch[i+k])==acronym[j][k]) count++;
  34. if(count==l) {i+=l-1; for(l+=1;acronym[j][l]!='\0';l++) cout<<acronym[j][l]; p=1; break;}
  35. }
  36. if(p==0)
  37. cout<<ch[i];
  38. }
  39. }
  40.  
  41.  
  42.  
  43. // Function main()
  44. void main()
  45. {
  46. clrscr();
  47. int acr=2, c;
  48. char ch[160], acronym[9][36]={"LOL=laughing out loud",
  49. "IRL=in real life",
  50. "AFK=away from keyboard",
  51. "BFF=best friends forever",
  52. "FWT=for the victory",
  53. "IIRC=if I recall correctly",
  54. "IMHO=in my humble opinion",
  55. "NVM=never mind",
  56. "TTYL=talk to you later"};
  57. cout<<">Press \"u\" if you want to upgrade the program's acromyms' list. ";
  58. c=getch();
  59. if(c==85||c==117) upgrade(acr);
  60. clrscr();
  61. cout<<">Enter your tweet(max. 160 characters): "; cin.getline(ch,160);
  62. search(ch,acronym,acr);
  63. cout<<"\n\n>Converting user's tweet......\n\n";
  64. display(ch,acronym,acr);
  65. getch();
  66. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'void upgrade(int&)':
prog.cpp:8:10: error: 'cout' was not declared in this scope
 { acr=9; cout<<"\n\n>Successfully updated the file."; getch(); }
          ^
prog.cpp:8:10: note: suggested alternative:
In file included from prog.cpp:1:0:
/usr/include/c++/5/iostream:61:18: note:   'std::cout'
   extern ostream cout;  /// Linked to standard output
                  ^
prog.cpp:8:61: error: 'getch' was not declared in this scope
 { acr=9; cout<<"\n\n>Successfully updated the file."; getch(); }
                                                             ^
prog.cpp: In function 'void search(char*, char (*)[36], int)':
prog.cpp:18:28: error: 'j' was not declared in this scope
    { for(int l=0,count=0;l<j;l++)
                            ^
prog.cpp:20:15: error: 'j' was not declared in this scope
     if(count==j) {cout<<'\n'<<acronym[i]; break;}
               ^
prog.cpp:20:19: error: 'cout' was not declared in this scope
     if(count==j) {cout<<'\n'<<acronym[i]; break;}
                   ^
prog.cpp:20:19: note: suggested alternative:
In file included from prog.cpp:1:0:
/usr/include/c++/5/iostream:61:18: note:   'std::cout'
   extern ostream cout;  /// Linked to standard output
                  ^
prog.cpp: In function 'void display(char*, char (*)[36], int)':
prog.cpp:34:63: error: 'cout' was not declared in this scope
       if(count==l) {i+=l-1; for(l+=1;acronym[j][l]!='\0';l++) cout<<acronym[j][l]; p=1; break;}
                                                               ^
prog.cpp:34:63: note: suggested alternative:
In file included from prog.cpp:1:0:
/usr/include/c++/5/iostream:61:18: note:   'std::cout'
   extern ostream cout;  /// Linked to standard output
                  ^
prog.cpp:37:5: error: 'cout' was not declared in this scope
     cout<<ch[i];
     ^
prog.cpp:37:5: note: suggested alternative:
In file included from prog.cpp:1:0:
/usr/include/c++/5/iostream:61:18: note:   'std::cout'
   extern ostream cout;  /// Linked to standard output
                  ^
prog.cpp: At global scope:
prog.cpp:44:11: error: '::main' must return 'int'
 void main()
           ^
prog.cpp: In function 'int main()':
prog.cpp:46:8: error: 'clrscr' was not declared in this scope
 clrscr();
        ^
prog.cpp:57:1: error: 'cout' was not declared in this scope
 cout<<">Press \"u\" if you want to upgrade the program's acromyms' list. ";
 ^
prog.cpp:57:1: note: suggested alternative:
In file included from prog.cpp:1:0:
/usr/include/c++/5/iostream:61:18: note:   'std::cout'
   extern ostream cout;  /// Linked to standard output
                  ^
prog.cpp:58:9: error: 'getch' was not declared in this scope
 c=getch();
         ^
prog.cpp:61:51: error: 'cin' was not declared in this scope
 cout<<">Enter your tweet(max. 160 characters): "; cin.getline(ch,160);
                                                   ^
prog.cpp:61:51: note: suggested alternative:
In file included from prog.cpp:1:0:
/usr/include/c++/5/iostream:60:18: note:   'std::cin'
   extern istream cin;  /// Linked to standard input
                  ^
stdout
Standard output is empty