How do I test if a word is in a text file and append it to the file if it isn't in C++? -
I am writing a nutritionist program in C ++ and I want to test whether the user has entered Within one of the food, text files for each of the five food groups, if so, increase the value of "servings (food group)", but if not, then it will ask which food group is of food And adds it to the same text file. How should I go about this? I did something like this in Python, where I read the text file in an array. Will this also work?
Yes it will!
Then you load the array stringstream
in
stringstream ss (std :: string (/ * array, length * /)); Four meals [256] = {0}; While (true) {SS & gt; & Gt; food; If (0 == strcmp (food, "burger")) // // got food! }}
or you can do it through ifstream
but remember that RAM is faster than HDD
Comments
Post a Comment