how to scan integers untill user enters a blank line ??
pls help me out guys !
pls share ur code !
Use getline()
function in C++
string s;
while (getline(cin, s)) {
if (s.size() > 0) {
int n;
stringstream inp(s);
inp >> n;
// do something with n
} else {
break;
}
}
1 Like
you can do this.
do
{
scanf("%d%c",&x,&s);
}while(s!='\n')