Hi guys. I'm on the verge of rage quitting and this is extremely frustring because I know EXACTLY what I need to do but I can't convey my thought into code.
I have a program that counts words from a file and it works just fine. But now I need to make it start counting from a particular word and stop counting when it reaches another particular word. Here is my loop.
1 2 3 4 5 6 7 8
while(wordfile>>nextword){
if(nextword == "BEGIN"){
count = true;
}elseif(nextword == "FINISH"){
count = false;
}
}
cout<<"Total words from BEGIN to FINISH is: "<<count<<endl;
What the hell is wrong with my loop! I've been trying to 2 hours just to fix this and I've tried everything but using a boolean control seems like the most logical way.
Please just fix this for me it's making me so angry :@