473,396 Members | 2,106 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.

What does "unqualified-id before" mean?

Could someone please explain to me what the "unqualified-id before" means, how to fix it, what I did wrong, and why it is the way that you say is the correct code?

Expand|Select|Wrap|Line Numbers
  1.  
  2. #include<iostream>
  3. #include<String>
  4. using namespace std;
  5. class person
  6. {
  7.       protected :
  8.             char name[40];
  9.       public:
  10.             virtual void getData()
  11.             {
  12.                  cout<<"Nhap vao ten:";
  13.                  cin>>name;
  14.             }
  15.             virtual void putData()
  16.             {
  17.                  cout<<"Ten:"<<name<<"\n";
  18.             }
  19.             virtual void isOutstanding()
  20.  
  21.             {
  22.             } 
  23. }
  24. /////////////////
  25.  
  26. class student:public person
  27. {
  28.       private:
  29.            float tbc;
  30.       public:
  31.            virtual void getData()
  32.            {
  33.                 person::getData();
  34.                 cout<<"Nhap vap diem trung binh cua sinh vien:\n";
  35.                 cin>>tbc;
  36.            }
  37.            void putData()
  38.            {
  39.                 person::putData();
  40.                 cout<<"Diem TBC = "<<tbc<<"\n";
  41.            }
  42.            void isOutstanding()
  43.            {
  44.                 if(tbc>=9.0)
  45.                 {
  46.                 cout<<"Day la hoc sinh xuat sac\n";
  47.                 }
  48.            }
  49. }
  50. //////////////////////////
  51.  
  52. class teacher:public person
  53. {
  54.       private:
  55.       int NumBook;
  56.            void getData()
  57.            {
  58.                 person::getData();
  59.                 cout<<"Nhap vao so sach da xuat ban cua giao vien:";
  60.                 cin>>NumBook;
  61.            }
  62.            void putData()
  63.            {
  64.                 person::putData();
  65.                 cout<<"sach xuat ban"<<NumBook<<"\n";
  66.            }
  67.            void isOutstanding()
  68.            {
  69.                 if(NumBook>=100)
  70.                 {
  71.                          cout<<"Giao vien xuat sac\n";
  72.                 }
  73.            }
  74. //////////////////////////
  75.  
  76. int main()
  77. {
  78.     person* persPtr[100];
  79.  
  80.     int n=0;
  81.     char choise;
  82.     do
  83.     {
  84.          cout<<"Nhap vao ten mot nguoi or sinh vien or giao vien :"<<"p; s; g";
  85.          cin>>choise;
  86.          if(choise=='s')
  87.          {
  88.                         persPtr[n] = new student;
  89.          }
  90.          if(choise=='g')
  91.          {
  92.                        persPtr[n] = new teacher;
  93.          }
  94.          else
  95.          {
  96.                        persPtr[n] = new person;
  97.          }
  98.          persPtr[n++]->getData();
  99.          cout<<"Co nhap nua hay khong(c/k):";
  100.          cin>>choise;
  101.     }
  102.     while(choise=='c');
  103.     for(int j=0;j<n;j++)
  104.     {
  105.             persPtr[j]->putData();
  106.             persPtr[j]->isOutstanding();
  107.     }
  108.     return 0;
  109.    // system("pause");
  110. }
  111.  
  112.  
Jun 5 '10 #1
1 3056
Banfa
9,065 Expert Mod 8TB
1st: please do not reply to ancient threads. If you think they are relevant to your post put a link to them in your post.

2nd: If you are getting compiler errors you should post them.

However I was feeling generous so I compiled your code myself. You have a mistake at line 3 which should be

#include <string>

with a lowercase s (you are probably using windows which is case insensitive but I am using Linux which is case sensitive and String and string are not the same filename). Once I fixed that I got these compilation errors

Expand|Select|Wrap|Line Numbers
  1. /home/ben/Development/ConsoleTester/main.cpp|111|error: expected ‘}’ at end of input|
  2. /home/ben/Development/ConsoleTester/main.cpp|111|error: expected unqualified-id at end of input|
  3.  
which brings us onto

3rd When you get compilations errors, particularly if you are new to programming, deal with the first one first. "unqualified-id" is the second error, the first error is "expected ‘}’ at end of input".

"expected ‘}’" is very obvious because it says exactly what the problem is, you have a missing '}' somewhere.

A 10 second scan of your code shows that the problem is you have not closed the opening brace of the class teacher.

Also not that a class declaration is a statement and must be followed by a ;
Jun 5 '10 #2

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

Similar topics

2
by: Steve Richter | last post by:
What does the "." mean in the following sql script stmts? use GO if exists (select * from dbo.sysobjects where id = object_id(N'.') and OBJECTPROPERTY(id,N'IsUserTable') = 1) drop table ....
3
by: RobertTG | last post by:
Someone please translate the code below into English... Particularly the indicated line Thanks function attachComment() { var aForms = document.getElementsByTagName("FORM"); for (var i = 0;...
6
by: allenj | last post by:
DB21085I Instance "md" uses "32" bits and DB2 code release "SQL08012" with level identifier "02030106". Informational tokens are "DB2 v8.1.0.16", "s030508", "MI00048", and FixPak "2". Product is...
58
by: Larry David | last post by:
Ok, first of all, let's get the obvious stuff out of the way. I'm an idiot. So please indulge me for a moment. Consider it an act of "community service".... What does "64bit" mean to your friendly...
2
by: needin4mation | last post by:
I was looking at this code, and have seen it in other code (like it): /// <summary> /// Bitmap font class for XNA /// </summary> public class BitmapFont { private SpriteBatch m_sb; private...
92
by: Heinrich Pumpernickel | last post by:
what does this warning mean ? #include <stdio.h> int main() { long l = 100; printf("l is %li\n", l * 10L);
45
by: loudking | last post by:
Hello, all I don't quite understand what does ((time_t)-1) mean when I execute "man 2 time" RETURN VALUE On success, the value of time in seconds since the Epoch is retu rned. On error,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...

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.