0

Not able to give input in the following format

1                //number of test case
"some string   " //string with succeeding spaces
13               //some integer

Below is the code:

int main(void){
    int i, j;
    int act_size;
    int tc;
    cin>>tc;
    std::string inp;
    while(tc--){
        getline(cin, inp);
        cin>>act_size;
        //inp = "Mr John Smith    ";
        //act_size = 13;
        printNewString(inp, act_size);
    }
}

When I run this program, it skips over the act_size input and program exits without any output. But if I hard code the values, it works fine.

Raghav Mittal
  • 210
  • 3
  • 9

0 Answers0