Here we go.
#include<conio.h> //Non standard header do you really "need" it?
//This is the way the headers are no .h's
#include<cstdio>
#include<iostream>
#include<string>
//Got to put it in the std namespace
using namespace std;
//I would recommend some minor style changes.
class link_stack
{
struct node
{
int id;
char name[10];
node *next;
};
node *top,*x,*ptr;
public:
link_stack()
{
top = x = ptr =NULL;
}
void push()
{
x = new node;
cout << "Enter an ID number and name: ";
cin >> x->id >> x->name;
x->next = top;
top = x;
}
int pop(char n[])
{
int result;
if(top==NULL)
{
cout<<"\nStack is Empty";
}
else
{
result = top->id;
strcpy(n, top->name);
x = top;
top = top->next;
delete x;
return result;
}
}
void empty()//What is this function really doing?
{
char name[10];
//while(!obj.empty()) Where is obj declared?
//{
// cout << pop(name) << ": " << name << endl;
//}
}
};
int main()//It is int main not void main!!!!!!!!!!!!!!!!!!!!!
{
link_stack obj;
int choice;
do
{
cout << "\n ----------MENU---------- \n";
cout << "1.Push\n"
<< "2.Pop\n"
<< "3.Exit";
cout << "\nEnter your choice: ";
cin>>choice;
switch(choice)
{
case 1:
obj.push();
break;
case 2:
//obj.pop(); Is this how you defined pop?
obj.empty();
break;
case 3:
cout << endl;
break;
}
}
while (choice != 3);
getch(); //Why not cin.get()?
//cin.ignore();
//cin.get();
return 0; //Need to return a value from main.
}