I am not a newbie but i don't understand following code's behaviour..

#include<iostream>
#include<cstdio>
using namespace std;
main()
{
    int a;
    char s[10];
    cin>>a;
    gets(s);
    cout<<s;
}

When input is like
"1 string"
it is good
but this does not work if input is
"1
string"
i.e. you can't hit enter after 1. why???

Suggested Topics

Topic Category Replies Views Activity
Off-topic 1 129 Apr 9

Want to read more? Browse other topics in Off-topic or view latest topics.