Advertisement
Guest User

cpp

a guest
Feb 20th, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. char choice;
  9. string line,line1;
  10. cout << "Is this the correct file?(Y/N)" << endl;
  11. cout << "Y = Yes" << endl;
  12. cout << "N = No" << endl;
  13. cin >> choice;
  14.  
  15. switch(choice){
  16. case 'Y' :
  17. case 'y' :
  18. ifstream mask, SUV;
  19. mask.open("mask_test_file1.txt");
  20. SUV.open("suv_test_file1.txt");
  21. if(mask.is_open()){
  22.  
  23. while (getline(mask,line))
  24. {
  25. cout <<line<<'\n';
  26.  
  27. }
  28. }
  29.  
  30. if(SUV.is_open()){
  31.  
  32. while(getline(SUV,line1)){
  33. cout << " " << endl;
  34. cout << line1 <<'\n';
  35. }
  36. }
  37.  
  38.  
  39.  
  40.  
  41. mask.close();
  42. SUV.close();
  43. cout << "File loaded" << endl;
  44.  
  45. break;
  46. }
  47. switch(choice){
  48. case 'N' :
  49. case 'n' :
  50. cout << "Incorrect file loaded" << endl;
  51. break;
  52.  
  53. }
  54.  
  55.  
  56.  
  57. return 0;
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement