fork download
  1.  
  2. #include<iostream>
  3. #include<string.h>
  4. #include<fstream>
  5. using namespace std;
  6. char encryptpass(char *pass) //function to encrypt
  7. {
  8.  
  9. for( int i=0; pass[i] != '\0'; ++i )
  10. char enpass[10]= ++pass[i];
  11. return(enpass);
  12.  
  13.  
  14. }
  15. char decryptpass(char *str) // function to decrypt
  16. {
  17. for( ; str!='\0'; ++str )
  18. char depass[10]= --str;
  19. return(depass);
  20.  
  21. }
  22.  
  23. int main() // main function
  24. {
  25. int flag=0;
  26. if(flag=0)
  27. {
  28. cout<<"enter your password";
  29. char pass[10];
  30. cin>>pass;
  31. fstream file("userpass.txt",ios::in | ios::out);
  32. file<<enpass[10];
  33. }
  34. else
  35. {
  36. cout<<"enter password";
  37. cin>>pass;
  38. bool check=false;
  39. static char str[10];
  40. file.seekg(ios::beg);
  41. file >> str;
  42. file.close();
  43. decryptpass(str);
  44.  
  45. if(pass=depass) // decrypted password is equal to input password ?
  46. {
  47. check=true; // set boolen value to true
  48. }
  49. else
  50. {
  51. cout<<"incorrect password";
  52. }
  53. return(0);
  54. } // end of main
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'char encryptpass(char*)':
prog.cpp:10:29: error: array must be initialized with a brace-enclosed initializer
    char enpass[10]= ++pass[i];
                             ^
prog.cpp:11:11: error: 'enpass' was not declared in this scope
    return(enpass);
           ^
prog.cpp: In function 'char decryptpass(char*)':
prog.cpp:18:20: error: array must be initialized with a brace-enclosed initializer
 char depass[10]= --str;
                    ^
prog.cpp:19:8: error: 'depass' was not declared in this scope
 return(depass);
        ^
prog.cpp: In function 'int main()':
prog.cpp:32:11: error: 'enpass' was not declared in this scope
     file<<enpass[10];
           ^
prog.cpp:37:8: error: 'pass' was not declared in this scope
   cin>>pass;
        ^
prog.cpp:40:4: error: 'file' was not declared in this scope
    file.seekg(ios::beg);
    ^
prog.cpp:45:14: error: 'depass' was not declared in this scope
      if(pass=depass)   // decrypted password is equal to input password ?
              ^
prog.cpp:54:2: error: expected '}' at end of input
  }    // end of main
  ^
stdout
Standard output is empty