0
hello peeps programming for me is not that easy thats why i ask questions.
How do i read numbers until a negative number is entered in c++
2 ответов
+ 5
while(true){
int n;
std::cin>>n;
if(n<0) break;
}
+ 1
Try to check every input - if input < 0, break your loop.
Like this:
int x = 0;
while(x>=0){
cin >> x;
}