473,699 Members | 2,526 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 1067
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
6602
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
5012
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
3291
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
5324
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
7588
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
19474
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
5688
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
4163
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
8623
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9197
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...
0
9054
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8941
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
8897
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
7785
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...
1
6549
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4390
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2015
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.