Untitled
unknown
plain_text
2 years ago
847 B
13
Indexable
#include <iostream>
#include <fstream>
#include <cctype>
#include <string>
#include <vector>
#include <sstream>
using namespace std;
int main()
{
string answer = " ", fileName = " ";
ifstream myFile;
cout << "If you want to open a service (function) defining file, then press (Y/y) for 'yes', otherwise press any single key" << endl;
cin >> answer;
while (answer == "y" || answer == "Y") {
cout << "Enter the input file name: ";
cin >> fileName;
myFile.open(fileName);
if (myFile.fail()) {
cout << "Could not open the file " << fileName;
return 0;
}
else if(true) {
cout << "okay";
string temp;
while(getline(myFile, temp)) {
cout << temp;
}
}
cout << "Do you want to open another service defining file? Press (Y/y) for 'yes', otherwise press anykey" << endl;;
cin >> answer;
}
return 0;
}Editor is loading...