K
kittykat
Hi again,
Ok, i've solved my own problem, but now i have a tiny problem that i can't
seem to solve. here's my code:
#include <fstream>
#include <string>
#include <iostream>
using namespace std;
int main()
{ string pattern;
ifstream myFile("data.txt");
cout << "Enter the item you are searching for: ";
cin >> pattern;
if (getline(myFile, pattern))
cout << "The pattern was found " << endl;
else
cout << "The pattern was not found in the list\n";
}
my code complied correctly. my problem is, when it runs, the window
appears and then disappears really quickly. i was wondering how i could
solve that?? is there something wrong with my code?
Ok, i've solved my own problem, but now i have a tiny problem that i can't
seem to solve. here's my code:
#include <fstream>
#include <string>
#include <iostream>
using namespace std;
int main()
{ string pattern;
ifstream myFile("data.txt");
cout << "Enter the item you are searching for: ";
cin >> pattern;
if (getline(myFile, pattern))
cout << "The pattern was found " << endl;
else
cout << "The pattern was not found in the list\n";
}
my code complied correctly. my problem is, when it runs, the window
appears and then disappears really quickly. i was wondering how i could
solve that?? is there something wrong with my code?