..how can i display what I've just input, including space????? example Name: Jazel Juarez ---> I've tried it but only the first word did print out ----- char question[] = "Name: "; char urname[80]; cout<<Name; getline(cin,question); cin>>urname; cout<<urname<<"!"; -->the program above... have 2 errors 1.declaration syntax error 2. the function getline should have prototype please help me thanks!
Yes, Itz better you should first delete the pointer and the realloc.... But if dnt delete then also there will be no problem because the OS Memory management will do the work 4 u...
use the gets() function which is found in the header file cstdio Code: #include <iostream> #include <cstdio> using namepace std; int main(){ char names[80]; cout <<"Please enter your two names"<<"\n"; gets(names); cout<<"Your name is "<<names; } or you can still use getline() Code: #include <iostream> int main(){ char names[80]; cout <<"Please enter your two names"<<"\n"; cin.getline(name,80); cout<<"Your name is "<<names; }