I have written the following code:
#include <iostream>
#include <string>
#include <cstdio>
using namespace std;
int main() {
int requirements, proposals;
string inutil_string;
while(scanf("%d %d", &requirements, &proposals), (requirements || proposals)) {
cout << proposals << endl;
for(int i = 0; i < requirements; i++) {
getline(cin, inutil_string);
cout << inutil_string << endl;
}
}
}
When I run the program, it does not read the string from the console through the getline() method and the line that contains cout does not show anything in the "inutil_string". Why do I obtain this behavior?. Note that the while loop must stop when "0 0" is typed.