Hi all,
I am new to C++...I tried to compile the following program...
#include<iostre am.h>
#include<conio. h>
#include<string >
#include<stdio. h>
int main() {
String mystr;
cout << "What is your name?";
getline(cin,mys tr);
cout << "my name is:" << mystr;
cout << "What is your favourite team?";
getline(cin, mystr);
cout << "My favourite team is " << mystr;
getch();
return 0;
}
but i am getting the error 'function getline should have a prototype'...I am getting other errors as well apart from this ...but i think if i can add the relevant "#include.. ." i can fix this error..can anyone please tell me what is it for 'getline' function...thnk in advnce...
I am new to C++...I tried to compile the following program...
#include<iostre am.h>
#include<conio. h>
#include<string >
#include<stdio. h>
int main() {
String mystr;
cout << "What is your name?";
getline(cin,mys tr);
cout << "my name is:" << mystr;
cout << "What is your favourite team?";
getline(cin, mystr);
cout << "My favourite team is " << mystr;
getch();
return 0;
}
but i am getting the error 'function getline should have a prototype'...I am getting other errors as well apart from this ...but i think if i can add the relevant "#include.. ." i can fix this error..can anyone please tell me what is it for 'getline' function...thnk in advnce...
Comment