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;
}

Use #include <string> and #include<iostream> instead of the versions you have.

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

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.