fork download
  1. #include <iostream> //Simple input / output with cout / cin
  2. #include <string> //contain the string functions (strcpy, strcat, strlen)
  3. #include <iomanip> //setprecision, setw
  4. #include <vector> //similar to arrays, push_back
  5. #include <cmath> //pow(double x, int y)
  6. #include <sstream> //Stringstream ss if (ss >> (int)i) {//do stuff}
  7. #include <fstream> // fin / fout
  8.  
  9. using namespace std;
  10.  
  11. int main(){
  12. int x=0;
  13.  
  14. cout << "\nThe value for x is "<< x;
  15. cout << "\nNow enter a new value for x: ";
  16. cin >> x;
  17. cin.ignore();
  18. char c[]="Hello World";
  19. char d[256];
  20. char e[101];
  21. strcpy(d , c);
  22.  
  23. cout << d;
  24.  
  25. cout <<"\n\nEnter a value for e: ";
  26. cin.getline(e, 100);
  27.  
  28. vector <int> vInt;
  29. vector <int>::iterator vIter;
  30.  
  31. for (int i=0; i<5; i++){
  32. vInt.push_back(i);
  33. }
  34.  
  35. ofstream fout;
  36. char fileName[]="/home/Damien/Output.txt";
  37. fout.open(fileName);
  38. for (vIter = vInt.begin(); vIter < vInt.end(); vIter++){
  39. fout << *vIter <<"\r\n";
  40. }
  41. fout.close();
  42. return 0;
  43. }
  44.  
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty