473,396 Members | 2,016 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

i am gettin an Error Identifier 'display' cannot have a type qualifier in function cu

Expand|Select|Wrap|Line Numbers
  1. #include <stdio.h>
  2. #include <conio.h>
  3. #include <string.h>
  4. #include <process.h>
  5. #include <ctype.h>
  6.  
  7. #include <fstream.h>
  8.  
  9. class customer
  10. {
  11.       char ph[10];
  12.       char name[30];
  13.       char add[40];
  14.       char type;
  15.       public :
  16.       void append();
  17.       void display();
  18.       void del();
  19.       void modify();
  20.       void list();
  21.       void help();
  22. }cust;
  23.  
  24.  
  25.  
  26. void customer::append()
  27. {
  28.       char choice;
  29.       fstream f;
  30.       f.open("tphone.dat", ios::app);
  31.       if (!f)
  32.       { cout<<"\n  Unable to open FILE.";
  33.       getch();
  34.       return;
  35.       }
  36.       while(1)
  37.       { clrscr();
  38. cout<<"\n\n***********************************************************************";
  39. cout<<"\n                                                  CUSTOMER RECORD";
  40. cout<<"\n\n***********************************************************************";
  41.      while(1)
  42.         {   cout<<"\n\tEnter the name";
  43.              cout<<"\nName              :   ";
  44.                          gets(name);
  45.              if(strlen(name)==0)
  46.  
  47.          cout<<"\n\n\tName cannot be left blank\a\a";
  48.                                       else
  49.              break;
  50.              }
  51.                     while(1)
  52.       { cout<< "\n\tEnter the address";
  53.              cout<<"\n    Address                           :   ";
  54.                         gets(add);
  55.              if (strlen(add) != 0)
  56.              break;
  57.              }
  58.  
  59.           while(1)
  60.       {     cout<<"\nEnter TelePhone. No.     :   ";
  61.                 cin>>ph;
  62.              if (ph != 0 )
  63.              break;
  64.              else
  65.              {
  66.              cout<<"\n\n\tTelePhone no. cannot be left blank\a\a";
  67.              }
  68.              }
  69.   while(1)
  70. {    cout<<    "Enter O for Office and R for residential phone";
  71.  
  72.       cout<<"catagory ( O/R )  :   ";
  73.       cin>>type;
  74. if (type=='o'||type=='O'||type=='r'||type=='R')
  75.             break;
  76. else{cout<<"\n   Wrong choise...";
  77. }
  78. }
  79. cout<<"\n\n**********************************************************************";
  80. cout<<"\n 1 :                        Save & Exit    2 :  Save & Cont.   0 : Exit without save";
  81. cout<<"\n\n**********************************************************************";
  82.       cin>>choice;
  83.       switch(choice)
  84.       {
  85.              case ('1') :      f.write((char *) this,sizeof(cust));
  86.                     f.close();
  87.                     return;
  88.              case ('2') :     f.write((char *) this,sizeof(cust));
  89.                     break;
  90.              case ('0') :   f.close();
  91.                     return;
  92.              default :      f.close();
  93.                     return;
  94.       }
  95.       }
  96.  
  97. void customer :: display()
  98. {
  99.       char p[10];
  100.       char choice;
  101.       int found=0;
  102.       int no;
  103.      long float bill=0.0, tax=0.0, bbill=0.0,rent;
  104.       fstream f;
  105.       f.open("tphone.dat", ios::in);
  106.       if (!f)
  107.       { cout<<"Unable to open a file";
  108.          getch();
  109.          f.close();
  110.          return;
  111.       }
  112.       while(choice != '0')
  113.       {
  114.       clrscr();
  115.             cout<<"Please enter the Phone No. ";
  116.       cin>>p;
  117.       if (!strcmp(p,"0"))
  118.              return;
  119.       found = 0;
  120.       f.seekg(0);
  121.       while (f.read((char *)this ,sizeof(cust)))
  122.       {
  123.              if (found==1)
  124.              break;
  125.              if (!strcmp(ph,p))
  126.              {
  127.              clrscr();
  128. cout<<"\n\n===================================================";
  129.  cout<<"\n\t                                               TELEPHONE BILL";
  130. cout<<"\n\n===================================================";
  131.              cout<<"\n\n    Name   :- \t           ";
  132.              cout<<name;
  133.                                      cout<<"\n    Address   :-  \t        ";
  134.              cout<<add;
  135.              cout<<"\n    TelePhone No.   :- \t     ";
  136.              cout<<ph;
  137.              cout<<"\n    Catagory ( O/R )   :- \t ";
  138.              cout<<type;
  139.                                       cout<<"\nNo. of calls   :- \t     ";
  140.              cin>>no;
  141.              if ( no<=150)
  142.               {if (toupper(type) == 'O')
  143.                  { bill=0;
  144.                 rent=150;  }
  145.             else
  146.             bill=0;rent=200;}
  147.                                                 if( no>150)
  148.                  {  no = no - 150;
  149.              if (toupper(type) == 'O')
  150.                 {   bill =(no * 1.00) ;  rent=150;
  151.               }
  152.              else
  153.                     {bill = (no * .80);
  154.             rent=200;
  155.              }}
  156.                                                     cout<<"\n=====================================================";
  157.              cout<<"\n      Charge :";
  158.                       cout<<bill;
  159.                                                  tax = (5*bill)/100;
  160.                          cout<<"\n       Service tax(5% ):  Rs ";
  161.                          cout<<tax;
  162.                         cout<<"\n       Rent :-  \nRs ";
  163.                         cout<<rent;
  164. cout<<"\n--------------------------------------------------------------------------------------------";
  165.  
  166.              cout<<"\n\n\tTOTAL BILL :  Rs " ;
  167.                  bbill = bill+tax+rent;
  168.                  cout<<bbill;
  169. cout<<"\n======================================================";
  170.              found = 1;
  171.           cout<< "\n Press a Key to continue";
  172.              getch();
  173.              }
  174.       }
  175. cout<<"\n=====================================================";
  176.       cout<<"\n\n  1 :  Cont.     0 : Exit ";
  177. cout<<"\n=====================================================";
  178.       cin>>choice;
  179.       switch(choice)
  180.       {
  181.              case ('1') :
  182.              break;
  183.              case ('0') : return;
  184.              default : return;
  185.       }}
  186.       f.close();
  187. }
  188. void customer :: list()
  189. {
  190.       clrscr();
  191.       fstream fp;
  192.       int r;
  193.       fp.open("tphone.dat", ios::in);
  194.       if (!fp)
  195.       {
  196.       cout<<"Unable to open";
  197.       getch();
  198.       fp.close();
  199.       return;
  200.       }
  201.       gotoxy(35,2);
  202.       cout<<"List of Customers";
  203.       gotoxy(35,3);
  204.       cout<<"*****************";
  205.       gotoxy(5,4);
  206.       cout<<"Name";
  207.       gotoxy(40,4);
  208.       cout<<"Phone No.";
  209.       gotoxy(65,4);
  210.       cout<<"Catagory";
  211.       gotoxy(1,5);
  212.       cout<<"**************************************************************************";
  213.       r=6;
  214.       while (fp.read((char *) this, sizeof(cust)))
  215.       {
  216.       if (r >= 21)
  217.       {
  218.  
  219.              getch();
  220.              clrscr();
  221.              gotoxy(35,2);
  222.              cout<<"List of customers";
  223.              gotoxy(35,3);
  224.              cout<<"*****************";
  225.              gotoxy(5,4);
  226.              cout<<"Name";
  227.              gotoxy(40,4);
  228.              cout<<"Phone No.";
  229.              gotoxy(65,4);
  230.              cout<<"Catagory";
  231.              gotoxy(1,5);
  232.              cout<<"***************************************************************************";
  233.              r=6;
  234.       }
  235.       gotoxy(5,r);
  236.       cout<<name;
  237.       gotoxy(40,r);
  238.       cout<<ph;
  239.       gotoxy(65,r);
  240.       if (toupper(cust.type) == 'O')
  241.              cout<<"Office";
  242.       else
  243.              cout<<"Residential";
  244.       r++;
  245.       }
  246.       cout<<"\n\n\nPress any key to continue ...";
  247.       getch();
  248.       fp.close();
  249. }
  250. void customer :: del()
  251. {
  252.       char ch;
  253.       char p[10];
  254.       fstream tp,f;
  255.       f.open("tphone.dat", ios::in);
  256.       if (!f)
  257.       {
  258.       cout<<"Unable to open Telephone file";
  259.       getch();
  260.       f.close();
  261.       return;
  262.       }
  263.       tp.open("temp.dat", ios::out);
  264.       if (!tp)
  265.       {cout<<"Unable to open Temporary file";
  266.       getch();
  267.       tp.close();
  268.       return;
  269.       }
  270.       clrscr();
  271. cout<<"\n\n***********************************************************************";
  272.       cout<<"\n   Enter the Phone No. to be deleted         : ";
  273.       cin>>p;
  274.       if(!strcmp(p,"0"))
  275.       return;
  276.       int found=0;
  277.       while (f.read((char *) this, sizeof(cust)))
  278.       {
  279.       if (!strcmp(p,ph))
  280.       {
  281.              found = 1;
  282.                     cout<<"\n   Name        :              "<<name;
  283.                   cout<<"\n   Address    :         " <<add;
  284.                     cout<<"\n   Catagory   :       "<<type;
  285. cout<<"\n\n***********************************************************************";
  286.                  cout<<"\n\n     Delete this record (Y/N)   ";
  287.                   cin>>ch;
  288.              if (toupper(ch) == 'N')
  289.              tp.write((char *) this,sizeof(cust));
  290.       }
  291.       else
  292.              tp.write((char *) this,sizeof(cust));
  293.       }
  294.       f.close();
  295.       tp.close();
  296.       if (toupper(ch) == 'N')
  297.       return;
  298.       if (!found)
  299.       {
  300.       cout<<"\n\nTelephone no. not found";
  301.       getch();
  302.       return;
  303.       }
  304.       f.open("tphone.dat", ios::out);
  305.       tp.open("temp.dat", ios::in);
  306.       while (tp.read((char *) this, sizeof(cust)))
  307.       f.write((char *) this, sizeof(cust));
  308.       f.close();
  309.       tp.close();
  310. }
  311.  
  312. void customer :: modify()
  313. {
  314.       char ch;
  315.       char p[10];
  316.       fstream tp,f;
  317.       f.open("tphone.dat", ios::in);
  318.       if (!f)
  319.       {
  320.       cout<<"\n   Unable to open Telephone file";
  321.       getch();
  322.       f.close();
  323.       return;
  324.       }
  325.       tp.open("temp.dat", ios::out);
  326.       if (!tp)
  327.       {
  328.       cout<<"\n   Unable to open Temporary file";
  329.       getch();
  330.       tp.close();
  331.       return;
  332.       }
  333.       clrscr();
  334. cout<<"\n\n***********************************************************************";
  335.       cout<<"\n   Enter the Phone No. to be Modify : ";
  336.       cin>>p;
  337.       if(!strcmp(ph,"0"))
  338.       return;
  339.       int found=0;
  340.       while (f.read((char *) this, sizeof(cust)))
  341.       {
  342.       if (!strcmp(p,ph))
  343.       {
  344.              found = 1;
  345. cout<<"\n\n***********************************************************************";
  346.              cout<<"\n\n    Name       "<<name;
  347.                     cout<<"\n    Address    " <<add;
  348.                   cout<<"\n    Catagory   "<<type;
  349. cout<<"\n\n**********************************************************************";
  350.         cout<<"\n\n       Modify this record (Y/N) ";
  351.              cin>>ch;
  352.              if (toupper(ch) == 'Y')
  353.              {
  354. cout<<"\n\n***********************************************************************";  cout<<"\n    CUSTOMER RECORD";
  355. cout<< "\n    Enter the customer record";
  356.              while(1)
  357.              {
  358.                                         cout<<"\n\n   Name              :   ";
  359.               gets(name);
  360.               if (strlen(name) != 0)
  361.                           break;
  362.              }
  363.                                       cout<<"\n   Address           :   ";
  364.              gets(add);
  365.              while(1)
  366.              {
  367.                                       cout<<"\n   Assigned Ph. No.  :   ";
  368.                          cin>>ph;
  369.              if (ph != 0 )
  370.                          break;
  371.              }
  372.  
  373. {    cout<<    "Enter O for Office and R for residential phone";
  374.         cout<<"catagory ( O/R )  :   ";
  375.         cin>>type;
  376. } } }
  377.       tp.write((char *) this,sizeof(cust));
  378.       }
  379.       f.close();
  380.       tp.close();
  381.       if (toupper(ch) == 'N')
  382.       return;
  383.       if (!found)
  384.       {
  385.           cout<<"\n\n    Telephone no. not found....!!";
  386.           getch();
  387.           return;
  388.       }
  389.       f.open("tphone.dat", ios::out);
  390.       tp.open("temp.dat", ios::in);
  391.       while (tp.read((char *) this, sizeof(cust)))
  392.       f.write((char *) this, sizeof(cust));
  393.       f.close();
  394.       tp.close();
  395. }
  396.  
  397. void customer :: help()
  398. {
  399.       clrscr();
  400. cout<<"\n\n***********************************************************************";
  401. cout<<"\n\n***********************************************************************";
  402.       cout<<"\n\n   This program is used to create a telephone bill for the customers. ";
  403.       cout<<"\n   There are two categories of the customers. First categories is  of";
  404.       cout<<" \n    Residential phones and second categories is of Office phones. Both";
  405.       cout<<"\n   the categories have different charges of the telephone bill. Charges";
  406.       cout<<"\n   of residential phones are 80 Paisa per call and Charges of Office ";
  407.       cout<<"\n   office phones are Rs. 1 per call. 150 call are free for each category";
  408.       cout<<"\n   Total bill for is equal to 5% tax plus and there is a fixed monthly charge ";
  409.       cout<<"\n   called rent for Office customers rent is Rs.150 and for Residential customers it is Rs.200.  ";
  410.  cout<<"\n CREATED BY-\n\t  Anmol Shrivastava , Ankit Puri  & Manish Pandey";
  411. cout<<"\n\n***********************************************************************";
  412. cout<<"\n\n***********************************************************************";
  413. getch();
  414. }
  415. void main()
  416. {
  417. clrscr();
  418.  char pass[10];
  419.      cout<<"enter your password "<<endl;
  420.      for(int i=0;i<5;i++)
  421.      {
  422.     pass[i]=getch();
  423.     cout<<"*";
  424.      }
  425.  if(strcmp(pass,"password")==0)
  426. {
  427.  
  428.      cout<<endl;
  429.  
  430.       char ch,ch1;
  431.       while(1)
  432.       {
  433.  
  434. cout<<"****************************************************************************";
  435. cout<<"\n\t\t\t                    BHARAT SANCHAR NIGAM LIMITED (B.S.N.L)";
  436. cout<<"\n\n***********************************************************************";
  437.  
  438.                          cout<<"\n\n\n\n\n\t\t  D    -    Display a Bill";
  439.              cout<<"\n\n\t\t  L    -    List of customers";
  440.              cout<<"\n\n\t\t  H    -    Help";
  441.              cout<<"\n\n\t\t  R    -    Enter \ Modify a record";
  442.              cout<<"\n\n\t\t  Q    -    Quit";
  443.              cout<<"\nEnter your choise   :";
  444.  
  445.      cin>>ch;
  446.       ch = toupper(ch);
  447.       switch(ch)
  448.       {
  449.       case ('Q') :clrscr();
  450. cout<<"***************************************************************************";
  451. cout<<" \n\n\t         Thank you for using Hybrid telephone billing program\n\n\n";                           cout<<"Good Bye \n\n\t";
  452. cout<<"\n\n\n                  CREATED BY-  Ankit Puri ,  Anmol Shrivastava  &  Manish Pandey ";
  453. cout<<"\n\n***********************************************************************";
  454.                 getch();
  455.                 exit(0);
  456.       case ('D') : cust.display();
  457.                  break;
  458.       case ('L') : cust.list();
  459.                  break;
  460.       case ('H') : cust.help();
  461.                  break;
  462.       case ('R') :
  463.              ch1 = 'A' ;
  464.              while(ch1 != 'Q')
  465.              {
  466.                     clrscr();
  467. cout<<"***************************************************************************";cout<<"\n\n\t\t\t            BHARAT SANCHAR NIGAM LIMITED (B.S.N.L)";
  468. cout<<"\n\n***********************************************************************";
  469.  
  470.  cout<<" \n\n\t     A    -    Append a record";
  471.  cout<<"     \n\t     D    -    Delete a record";
  472.  cout<<"     \n\t     M    -    Change a record";
  473.  cout<<"       \n\t     Q    -    Quit";
  474.  cout<< "\n\n\tSelect your choice :- ";
  475. cout<<"\n\n***********************************************************************";
  476.             cin>> ch1;
  477.                     ch1 = toupper(ch1);
  478.                     switch(ch1)
  479.                     {
  480.                     case ('A') : cust.append();
  481.                         break;
  482.                     case ('D') : cust.del();
  483.                         break;
  484.                     case ('M') : cust.modify();
  485.                         break;
  486.                                              }
  487.              }
  488.                              }
  489.  
}
Jan 12 '14 #1
1 2610
weaknessforcats
9,208 Expert Mod 8TB
There are several errors in the code. The biggest one is not including iostream.h. I also found the member function customer::append() is missing a closing brace.

I also received many other warnings due to using the pre-1998 C++ headers, like fstream.h.

I recommend using a newer compiler.
Jan 12 '14 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: David | last post by:
I am getting the following error during run-time compilation or a rebuild all of my application: error BC30311: Value of type 'mynamespace.x' cannot be converted to 'mynamespace.x' This...
4
by: RedJoy | last post by:
I am switching from VS2003 .NET to VS2005 and I receive the following errorwhen compiling my project: error C3821: 'File': managed type or function cannot be used in an unmanaged function...
3
by: felix.dorner | last post by:
Hi. I have problems validating the following document doc.xml using onsgmls. I call onsgmls like this: >onsgmls -s /usr/share/sgml/xml.dcl doc.xml the output is: onsgmls:1_3_b.xml:2:19:W:...
2
by: mahesh | last post by:
Can anyone direct me to the place where i find the solution for the error message "cannot call member function 'X' without object"??? thanks in advance
4
by: Ben Petering | last post by:
Hi group, this is a 'best practice' type question (I want discussion of the issue - whys and why nots - similar to "casting the return value of malloc()", to cite an analogous case). Let's...
6
by: Pixel.to.life | last post by:
So I have this perfectly fine and running app, that uses managed C++ forms. Problem#1: I pass a Bitmap reference to a class, hoping to modify it in one of the class's methods, so it reflects...
6
by: muby | last post by:
Hi everybody :) I'm modifying a C++ code in VC++ 2005 my code snippet void BandwidthAllocationScheduler::insert( Message* msg, BOOL* QueueIsFull,
3
by: abhijit mudugan | last post by:
i'm getting an error 'identifier display cannot have type qualifier' near the bold portion. what's wrong??? #include<iostream.h> #include<conio.h> #include<stdio.h> #include<stdlib.h> class...
1
by: KasimDelovan | last post by:
I have got this error: I get the error: Identifier 'deposit' cannot have a type qualifier I have defined this class class BankAccount { private: double balance; ...
1
by: prathamnitika | last post by:
int food :: last_code(void) { fstream file; file.open("FOOD.DAT", ios::in); file.seekg(0, ios::beg); int t=0; while(file.read((char *) this, sizeof(food))) t=itemcode; ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.