473,749 Members | 2,402 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error rectification

1 New Member
Can you help rectify two errors in the following program:
1. Statement missing ;
2. Declaration terminated incorrectly

Expand|Select|Wrap|Line Numbers
  1. #include<iostream.h>
  2. #include<stdio.h>
  3. #include<conio.h>
  4. class student
  5. {
  6.  int rollno;
  7.  char name[25];
  8.  char grade;
  9.  float marks;
  10.  public: void readstudent()
  11.  
  12.  {
  13.   cout<<"Enter the rollno.:";
  14.   cin>>rollno;
  15.   cout<<"\nEnter the name:";
  16.   gets(name);
  17.   cout<<"\nEnter the marks:";
  18.   cin>>marks;
  19.   }
  20.    void disstudent()
  21.    {
  22.     cgrade();
  23.     cout<<"\nRollno:"<<rollno;
  24.     cout<<"\nName:"<<name;
  25.     cout<<"\nMArks:"<<marks;
  26.     cout<<"\nGrade:"<<grade;
  27.     }
  28.     int getrollno()
  29.     {
  30.      return rollno;
  31.      }
  32.     float getmarks()
  33.     {
  34.      return marks;
  35.      }
  36.     void cgrade()
  37.     {
  38.      if(marks>=75)
  39.      {
  40.       grade='O';
  41.       }
  42.      else if(marks>=60)
  43.      {
  44.       grade='A';
  45.       }
  46.      else (marks>=40)
  47.      {
  48.       grade='F';
  49.       }
  50.       }
  51.  
  52.    void main()
  53.    {
  54.     clrscr();
  55.     student s[3];
  56.     for (int i=0;i<3; i++)
  57.     {
  58.      cout<<"Enter details of student"<<i+1<<":";
  59.      s[i].readstudent();
  60.      }
  61.       int ch,rno,pos=-1,highmarks=0;
  62.       do{
  63.      cout<<"Main Menu \n 1.Specific student\n 2.Topper\n 3.Exit \n Enter the choice:\n";
  64.      cin>>ch;
  65.      switch(ch)
  66.      {
  67.       case 1: cout<<"Enter the rollno:\n";
  68.       cin>>rno;
  69.       for(int i=0;i<3;i++)
  70.       {
  71.        if (s[i].getrollno()==rno)
  72.        {
  73.         s[i].disstudent();
  74.         break;
  75.         }
  76.        }
  77.         if(i==10)
  78.         {
  79.          cout<<"Invalid";
  80.          }
  81.       case 2: for(i=0;i<3;i++)
  82.       {
  83.        if (s[i].getmarks()>highmarks)
  84.         {
  85.          pos=i;
  86.          highmarks=s[i].getmarks();
  87.          }
  88.         }
  89.          s[i].disstudent();
  90.          break;
  91.       case 3: break;
  92.       default: cout<<"Wrong";
  93.       break;
  94.      }
  95.     }
  96.      while(ch>=1&&ch<3);
  97.      getch();
  98.     }
  99.  }
  100.  
Sep 5 '16 #1
1 1068
weaknessforcats
9,208 Recognized Expert Moderator Expert
You have mismatched braces. It looks like the main() is inside the class definition. There's one place where you have
"if (i == 10)" but there is no i variable defined.

The class definition does not end with a ;.
Sep 6 '16 #2

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

Similar topics

13
6611
by: deko | last post by:
I use this convention frequently: Exit_Here: Exit Sub HandleErr: Select Case Err.Number Case 3163 Resume Next Case 3376 Resume Next
7
5019
by: p | last post by:
WE had a Crystal 8 WebApp using vs 2002 which we upgraded to VS2003. I also have Crystal 9 pro on my development machine. The web app runs fine on my dev machine but am having problems deploying. I created the websetup and built the MSI, have the bundled version. Copied to webserver and ran Websetup.msi. Said I had to remove old version, which I did, then reran WebSetup.msi and keeps giving me this error. "The installer was interrupted...
1
3293
by: developer | last post by:
Hi All I have made a .NET project. the files included are borland c++ files that i am migrate to VC++ .NET I am using Microsoft Visual C++ .NET 2003. the compilation goes through properly, but throws a load of linker errors
2
5331
by: f rom | last post by:
----- Forwarded Message ---- From: Josiah Carlson <jcarlson@uci.edu> To: f rom <etaoinbe@yahoo.com>; wxpython-users@lists.wxwidgets.org Sent: Monday, December 4, 2006 10:03:28 PM Subject: Re: 1>make_buildinfo.obj : error LNK2019: unresolved external symbol __imp__RegQueryValueExA@24 referenced in function _make_buildinfo2 Ask on python-list@python.org . - Josiah
2
7590
by: mythilikumar | last post by:
Iam unable to complie my c programs? it shows out an error as "unable to include stdio.h" what to do,i feel that there is some problem in my computer what is the rectification?
2
19485
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I will be writing this article intended for those who are in the same level, or maybe lower, of my technical knowledge. I would be using layman's words, or maybe, my own words as how I understand them, hoping, you will understand it the same way that...
15
5692
by: madhu.ab | last post by:
Hi All, I am getting the following errors when i am including header file winuser.h I dont know whats happening. How will an error occur in winuser.h?? Please help. \microsoft visual studio\vc98\include\winuser.h(39) : error C2061: syntax error : identifier 'HDWP'
0
2897
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I will be writing this article intended for those who are in the same level, or maybe lower, of my technical knowledge. I would be using layman's words, or maybe, my own words as how I understand them, hoping, you will understand it the same way that...
5
4164
by: yashu0209 | last post by:
I have an error occurring when i try to compile the program and the error is: D:\Program Files\visual studio 6.0\MSDev98\MyProjects\GLEnabledView\GLNew.cpp(164) : error C2653: 'CGLEnabledView' : is not a class or namespace name D:\Program Files\visual studio 6.0\MSDev98\MyProjects\GLEnabledView\GLNew.cpp(164) : error C2061: syntax error : identifier 'CGLEnabledView' D:\Program Files\visual studio...
0
8996
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9566
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9333
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9254
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8256
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3319
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2217
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.