473,383 Members | 1,870 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,383 software developers and data experts.

Error rectification

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 1055
weaknessforcats
9,208 Expert Mod 8TB
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
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
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....
1
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,...
2
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: ...
2
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
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...
15
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...
0
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...
5
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' :...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: 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
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...

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.