I just started learning language this year so I'm very new. i ran into a problem with this lottery program as apart my class assignment. i got the cin.get(ch) to work previously in the program but when it reaches this part it skips through the stop. and reason why?
1 2 3 4 5 6 7 8
cin >> num6;
}
cout << "Ready to see your results!!! \n";
cout << "Press enter to continue \n";
cin.get(ch);
cout << "the lottery pick this week were \n" << val1 << "\n" << val2 << "\n" << val3 << "\n" << val4 << "\n" << val5 << "\n" << val6 << "\n";
Because when you enter num6, you do it like that: 123 "Enter" cin >> num6; will read only digits, leaving "Enter" (newline symbol) in buffer for following input operation to read. cin.get(ch); just happens to read it.
Thanks for responding. In my HLA class my teacher told me something like that and said when you enter a number the reguster only takes he number an leaves the enter so you have to put that to clear old data for new data before the input put something like that. he gave us this line to use.
stdin.flushInput();
is the something similar in c++
i fixed the problem by doing this
cout << "Ready to see your results!!! \n";
cout << "Press enter to continue \n";
cin.get(ch);
cin.get(ch);
is there an easier way to gt this done without having to repeat this