Quote
1. ,"Write a program that consists of a while-loop that (each time around the
loop) reads in two ints and then prints them. Exit the program when a
terminating "|" is entered.
loop) reads in two ints and then prints them. Exit the program when a
terminating "|" is entered.
now the code starts out with
int val1=0;
int val2=0;
while(cin>>val1>>val2){
[INDENT]//code here[/INDENT]
}
sorry i didn't put everything, I just wanted to abbreviate it and make it short just to give an idea of how it goes. Thing is, when reading in integers and doubles, the program ends simply with anything thats NOT a number. So how would I exit a while-loop such as that with only the "|" character??
Maybe thats a dumb question but i'm just kind of not seeing the answer.


Sign In
Create Account

Back to top









