fork download
  1. #include <iostream>
  2. #include <fstream>
  3.  
  4. using namespace std;
  5.  
  6.  
  7.  
  8. int main(void)
  9. {
  10. /*ifstream myReadFile;
  11.  myReadFile.open("Questions.txt");
  12.  char output[100];
  13.  if (myReadFile.is_open()) {
  14.  while (!myReadFile.eof()) {
  15.  
  16.  
  17.   myReadFile >> output;
  18.   cout<<output;
  19.  
  20.  
  21.  }
  22. }
  23. myReadFile.close();
  24. return 0;
  25. }*/
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32. /*void Questions::getQuestion(int choice)
  33. {
  34.   choice = choice;
  35. }
  36.  int main()
  37.  { string reply;
  38.  
  39.  while (true)
  40.  {
  41.   cout <<"\nwhat \n";
  42.   cin >> reply;
  43.   switch (reply)
  44.   {
  45.   case "three":
  46.   cout << "3";
  47.   break;
  48.  
  49.   case "two": cout << "2";
  50.   break;
  51.  
  52.   case "one": cout << "1";
  53.   break;
  54.   default: cout << "querty";
  55.   }
  56.  }
  57.  cin.get();
  58.  cin.get();
  59.  } // main
  60.  */
  61.  
  62.  
  63. ofstream myfile;
  64. myfile.open ("Questions.txt");
  65. myfile << "Writing this to a file.\n";
  66. myfile.close();
  67. return 0;
  68.  
  69. }
Success #stdin #stdout 0s 3024KB
stdin
Standard input is empty
stdout
Standard output is empty