
Code: Select all
#include<iostream>
#include<string>
using namespace std;
int main()
{
string mystring;
getline(cin,mystring);
cout<<mystring;
return 0;
}
Moderator: Board moderators
Code: Select all
#include<iostream>
#include<string>
using namespace std;
int main()
{
string mystring;
getline(cin,mystring);
cout<<mystring;
return 0;
}
Code: Select all
cout<<mystring;
Code: Select all
cout<<mystring<<endl;
Actually this is working but it works some thing like this code:after I write something and then press "enter", it doesn't work then if I press "enter" again then it takes the input. how can I solve this problem?
Code: Select all
scanf("%s\n",str);