how i can use string here ?
char fullname[20];
cout<<"\nEnter your <full name>:";
cin>>fullname;
when i leave space between my name it break the program
how i can use string please need help
i have used that i am using that codes in for loop so program doesnt want my name i dont know why ?
what else i can use
I don't understand your issue. Please clarify
when i use this code ==> getline(cin, fullname);
program doesnt want my name just it show in enter your name but
there is no line to enter my name
do you understand ?
i am definitely sure i Cant enter my name what i have to do ?
It does work. You must put the code in a program and compile it and then run it.
1 2 3 4 5 6 7 8 9 10 11 12 13
|
#include<iostream>
int main()
{
using std::string;
using std::cin;
using std::cout;
string fullname;
cout << "Enter name: ";
getline(cin, fullname);
cout << fullname;
return 0;
}
|
Last edited on