NEED help please. here's our code. We wanted to print its output file. what function will we use? how will we do it? .We wanted to add printing in the menu.thanks

#include<iostream.h>
#include<stdlib.h>
#include<conio.h>
#include<stdio.h>
struct node{
 int x;
 char h[50]; //last name
 char fn[10];
 struct node *next;
 };
 typedef node nd;
 nd *head, *p, *display, *search, *update, *pointer;
 void insert(int num/**, char name*/)
 {
    // p=p->next;
  nd * temp;
  temp=(nd*)malloc(sizeof(nd));
  temp->x=num;
  char lname[50];// last name
  char fname[50];// first name
  cout << "Last Name: ";
  cin >>lname;
  for( int a=0;a<sizeof(lname) ;a++)
  {
  temp->h[a]=lname[a];
  }
  cout << "First Name: ";
  cin >> fname;
  for( int b=0;b<sizeof(fname) ;b++)
  {
  temp->fn[b]=fname[b];
  }
  //p->next=temp;
    // p=p->next;

  if(head==NULL)
  {
   head=temp;
   p=head;
   display=p;
   search=p;
   update=p;
   display=update;
   pointer=temp;
  }
  else
  {
   p->next = temp;
   p=p->next;
   display=p;
   search=p;
   update=p;
   display=update;
   pointer=temp;
  }
 }
 void search_emp( int ID_search)
 {
   search->next=NULL;
     search=head;
     //p=head;
     //while(p!=NULL)
     while(search!=NULL)
     {
     if( ID_search==search->x)
      {
      cout << "\nID number: " << search->x;
      cout << "\nLast Name: " << search->h;
      cout << "\nFirst Name: " << search->fn;
      // search=search->next;
      }
     else if( ID_search == NULL )
      {
      cout << " No ID Found!!! ";
      break;
      }
       search=search->next;
     }
   }
   void update_emp( int profile )
   {
   clrscr();
   int ans;
   do{
   int new_ID;
   char new_lname[50];
    update->next=NULL;
     update=head;
     //p=head;
     //while(p!=NULL)
     while(update!=NULL)
     {
     if( profile==update->x)
      {
      cout << "-----------------------------------------------------------\n";
      cout << "                       UPDATE EXISTING FILE                \n";
      cout << "-----------------------------------------------------------\n";
      cout << "\nID number: " << update->x;
      cout << "\nLast Name: " << update->h;
      cout << "\nFirst Name: " << update->fn;
      }
        update=update->next;
   cout << "\nChoose what to update:\n";
   cout << "[1] ID Number\n";
   cout << "[2] Last Name\n";
   cout << "[3] First name\n";
   cout << "[4] Update Again?";
   cout << "[5] Exit\n";
   cout << "Enter Task : ";
   cin >>  ans;
   if( ans==1)
   {
    cout << "Enter new ID number: ";
    cin >> new_ID;
    update=pointer;
    update->x=new_ID;
   }
   else if( ans==2)
   {
       cout << " Enter new Last Name : ";
       cin >>new_lname;
       for( int a=0;a<sizeof(new_lname) ;a++)
       {
         update->h[a]=new_lname[a];
         update=pointer;
         update->h[a]=new_lname[a];
       }
   }
    }
    }
    while(ans==4);
    }

 void deleteNode(int num)
 {   p=p->next;
  nd *temp;
  p=head;
  if(head->x == num)
  {
   temp=head;
   head=head->next;
   p=head;
   free(temp);
  }
  else
  {
   while(p!=NULL)
   {
    if(p->next->x == num)
    {
     cout << "Value to Delete: " << p->next->x;
     temp = p->next;
     p->next= p->next->next;
     free(temp);
     break;
    }
    else{
     p=p->next;
      }
    }
   }
   p=head;
   while(p!=NULL)
   {
    cout << p->next;
    p=p->next;
   }
  }
  void main()
  {
   clrscr();
   int val, select, ID, update_pro;
   char nm;
   char choice;
   do{
    cout << "Selecte an Operation:\n";
    cout << "[1] Insert value\n";
    cout << "[2] View List\n";
    cout << "[3] Delete node\n";
    cout << "[4] Searche Employee\n";
    cout << "[5] Update existing\n";
    cout << "Enter choice:";
    cin >> select;
    if(select == 1)
    {
     cout << "\nEnter ID number:";
     cin >> val;
      // cout << "Enter Name:";
      // cin >> nm;
     insert(val/**,nm*/);
    }
    else if( select == 2)
    {
     //p->next=NULL;
     display->next=NULL;
     display=head;
     //p=head;
     //while(p!=NULL)
     while(display!=NULL)
     {
      cout << "\nID number: " << display->x;
      cout << "\nLast Name: " << display->h;
      cout << "\nFirst Name: " << display->fn;
        display=display->next;
     }
    }
    else if( select == 3)
    {
     cout << " Enter ID number to be deleted: ";
     cin >> val;
     deleteNode(val);
    }
    else if( select == 4)
    {
     cout << "\nSearch by ID Number:";
     cin >> ID;
     search_emp(ID);
    }
    else if( select == 5)
    {
     cout << "Enter Employee ID Number to update Profile: ";
     cin >> update_pro;
     update_emp(update_pro);
    }
    cout << " \nDo You Want to continue?:";
    cin >> choice;
   }while(choice == 'y');
  }

what compiler are we using ? And why are we mixing C functions with c++ code? If you are going to write are c++ program then do so. Yea I know c++ language supports those c functions but its a lot better style to use all c++.

we're using the old dos compiler. this is our project. and were having difficulty in that part. about that print thinggy coz we wrenot taught bout that

your old DOS compiler probably supports stdprn, just as it does stdin, stdout and stderr. If so, then just print to stdprn

fprintf(stdprn,"Hello World\n");

But your compiler can not access network printers -- the printer must be on LPT1.

This article has been dead for over six months. Start a new discussion instead.