Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.15 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include "Cipher.h"
  4.  
  5. using namespace std;
  6.  
  7. void performAction( );
  8. string getInput( string );
  9.  
  10. string openFile( string, bool );
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17. int main (int argc, char * const argv[]) {
  18.     // insert code here...
  19.     std::cout << "Hello, World!\n";
  20.    
  21.     performAction();
  22.    
  23.     return 0;
  24. }
  25.  
  26. string getInput( string sMessage )
  27. {
  28.  
  29.     string sInput;
  30.     cout << sMessage << "\n";
  31.     //cin >> sInput;
  32.     getline(cin, sInput); // Something happens here :(
  33.     return sInput; // And here that goes bonko!
  34.    
  35. }
  36.  
  37. void performAction( )
  38. {
  39.     // ERROR HAPPENS HERE-ISH
  40.     string sTemp = getInput( "Please enter a keyword:" );
  41.    
  42.     cout << sTemp << "\n";
  43.    
  44.     //Cipher oCiph( "LEMON", true );
  45.    
  46.     string sFile = getInput( "Please Choose a File:" );
  47.    
  48.     while ( sFile.length() == 0 )
  49.     {
  50.         cout << "Invalid file name";
  51.         sFile = getInput( "Please Choose a File: " );
  52.     }
  53.    
  54.    
  55.    
  56. }
  57.  
  58.  
  59.  
  60.  
  61. Hello, World!
  62. Please enter a keyword:
  63. test
  64. CIS_Assign5(13802) malloc: *** error for object 0x10000c780: pointer being freed was not allocated
  65. *** set a breakpoint in malloc_error_break to debug
  66. Program received signal:  “SIGABRT”.
  67. (gdb)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement