BHXSpecter

Playing with C++

Oct 6th, 2011
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.72 KB | None | 0 0
  1. // Playing with features of C++ to learn more on using them
  2.  
  3. #include <fstream>
  4. #include <iostream>
  5. #include <string>
  6.  
  7. using namespace std;
  8.  
  9. void infoInput(istream& inF, string& inData);
  10. void infoOutput(ostream& outF, const string outData);
  11.  
  12. int main()
  13. {
  14.     string data;
  15.     infoInput(cin, data);
  16.     ofstream outFile;
  17.     outFile.open("OstreamTest.txt", ios::app);
  18.    
  19.     infoOutput(outFile, data);
  20.     infoOutput(cout, data);
  21.    
  22.     return 0;
  23. }
  24.  
  25. void infoInput(istream& inF, string& inData)
  26. {
  27.     getline(inF, inData);
  28. }
  29.  
  30. void infoOutput(ostream& outF, const string outData)
  31. {
  32.     outF << outData;
  33. }
  34.    
  35.  
  36.  
  37. // Sample Output - Shows my dorkiness
  38. // Mortal Kombat is the reason I got into programming. Now I'm a programmer! YEAH!!!
  39.  
Advertisement
Add Comment
Please, Sign In to add comment