My program is building and running, but the program terminates after the input without going into the if else section, and nothing is outputted. I'm not sure how to fix it because there aren't any actual errors being displayed. I know I must have coded something wrong, but I can't figure out what. Any help would be greatly appreciated!
Thank you, I went in and read the links you shared, and added the following based on the feedback in those posts. But my program is still not outputting anything. It just askes the user to input and then ends. Did I do the while loop or if/else wrong?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#include <iostream>
#include <string>
#include <limits>
usingnamespace std;
int main ()
{
...
std::cout << "Press ENTER to continue...";
std::cin.ignore( std::numeric_limits<std::streamsize>::max(), '\n' );
return 0;
}
There is an overflow I guess, try changing the condition in while to sub< size. Also if you are looking for only one item, break the while once the item is found.
I am not sure weather it works or not, but worth a try