0

Sir,
i have done this code
but an error is coming......
the function getline should have a prototype
undefined symbol 'string'

what shoul i do?
I am compiling this code in turbo c++ compiler.....

#include<string.h>
#include<iostream.h>
#include<conio.h>
using namespace std;
int main() 
{
 
    string number;
    string name;
 
    cout << "Please enter  number." << endl;
    getline(cin, number);
    cout << "Enter your name " << endl;
    getline(cin, name);
 
    cout << "\n " << name<< "\t" << number << endl;
    return 0;
}

Edited by Ezzaral: Added code tags. Please use them to format any code that you post.

3
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by VernonDozier
0

i have tried to use #include<string> and #include<string>
but the error is unable to include file IOSTREAM and STRING also getline has no prototype

0

i have tried to use #include<string> and #include<string>
but the error is unable to include file IOSTREAM and STRING also getline has no prototype

You have #include <string> twice. You need #include <iostream> . You don't need the conio.h line.

If you delete the conio.h line and make the changes suggested above and you are compiling correctly with a modern compiler, installed correctly, your program should compile just fine. It might be time to upgrade to a modern compiler.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.