Hello, I'm having trouble solving this problem. I have tried some other codes and they seem like they work but I am not sure how the files are made or how this code works. It will be helpful that you show me how. Thank you so much. (In C++)
If you have any doubts, please give me comment...
#include <iostream>
#include <fstream>
using namespace std;
void findKeyWord(string fileName, string key)
{
ifstream fin;
fin.open(fileName.c_str());
if (!fin.is_open())
cout << "Unable to
open the input file." << endl;
else
{
string line;
while (!fin.eof())
{
getline(fin, line);
if (line.find(key) != -1)
cout << fileName << ": " << line <<
endl;
}
fin.close();
}
}
int main(int argc, char **argv)
{
if (argc < 3)
{
cout << "Invalid
number of parameters." << endl;
return 0;
}
for (int i = 2; i < argc; i++)
findKeyWord(argv[i],
argv[1]);
}
Hello, I'm having trouble solving this problem. I have tried some other codes and they seem like they work but I am...
Hello, I am having some trouble with a supermarket checkout simulation program in C++. What I have so far just basically adds customers to the queue and prints when they arrive. I am struggling with how to implement a way of keeping track of when a given customer finishes(I will attach what I have so far). I had already created queue and node classes (with headers and cpp files) that I modified in my attempt. I would be very grateful...