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

Getting various errors and warnings.

Expand|Select|Wrap|Line Numbers
  1. #include<iostream.h>
  2. #include<conio.h>
  3. #include<fstream.h>
  4. #include<string.h>
  5. #include<stdlib.h>
  6.  
  7.   class sinfo
  8.   {
  9.       char sname[30];
  10.       char contact[12];
  11.       char addr[40];
  12.       int  month;
  13.       int  day;
  14.       int  year;
  15.       char mother[20];
  16.       char father[20];
  17.  
  18.     public:
  19.       void cinfo()
  20.         {   char ch;
  21.         lb: cout<<"\n Enter course info(M/E):"<<"\n"<<"\n";
  22.         cin>>ch;
  23.         if(ch=='M'||ch=='m')
  24.         {
  25.             cout<<"\n You have chosen Medical Course:";
  26.         }
  27.         else if(ch=='E'||ch=='e')
  28.         {
  29.             cout<<"\n You have chosen Engineering Course:";
  30.         }
  31.         else
  32.             cout<<"\n Wrong option! Choose again!";
  33.             goto lb;
  34.  
  35.         }
  36.         void input(void);
  37.         };
  38.         sinfo form;
  39.  
  40.     void sinfo::input(void)
  41.     {
  42.       ifstream filn,filc,fila,fild,filf,film,fili;
  43.       filn.open("names",ios::out|ios::app);
  44.       filc.open("contacts",ios::out|ios::app);
  45.       fila.open("addresses",ios::out|ios::app);
  46.       fild.open("date of births",ios::out|ios::app);
  47.       filf.open("fathers",ios::out|ios::app);
  48.       film.open("mothers",ios::out|ios::app);
  49.       fili.open("course infos",ios::out|ios::app);
  50.       int d;
  51.       void cinfo();
  52.       cout<<"\n Enter your name:";
  53.       filn.getline(form.sname,20);
  54.       cout<<"\n Enter contact information:";
  55.       filc.getline(form.contact,12);
  56.       cout<<"\n Enter Address:";
  57.       fila.getline(form.addr,30);
  58.       cout<<"\n Enter date of birth:(DD/MM/YYYY)";
  59.       for(int i=0;i<=2;i++)
  60.       {
  61.       cin>>d[i];
  62.       }
  63.       cout<<"\n Enter Father/Guardian's name: ";
  64.       filf.getline(form.father,20);
  65.       cout<<"\n Enter Mother's name:";
  66.       film.getline(form.mother,20);
  67.     }
  68.  
  69.  
  70.  
  71. void eng()
  72. {
  73.     int a;
  74.     cout<<"          "<<"\n"<<"\n";
  75.     cout<<"          \n ENGINEERING COURSES FOR JEE (MAIN) & JEE (ADVANCED)";
  76.     cout<<"          "<<"\n"<<"\n"<<" 1. Second Step Course:"
  77.     <<"          "<<"\n"<<"\n"<<" 2. First Step Course:"
  78.     <<"          "<<"\n"<<"\n"<<" 3. Crash course:";
  79.     cout<<"\n Enter your choice:";
  80.     cin>>a;
  81.     switch(a)
  82.     {
  83.     case 1: cout<<"                     \n :SECOND STEP COURSE: JEE MAIN & ADVANCED" <<"\n"<<"\n"<<"\n"<<"\n"<<"\n";
  84.         cout<<"                      \n The course details are as follows"<<"\n"<<"\n"<<"\n"<<"\n"<<"\n"<<"\n";
  85.         cout<<"                       \n * STARTING FROM:"<<"\n"<<"\n"<<"2nd week of April,2014"<<"\n"<<"\n";
  86.         cout<<"                       \n * CONTINUES UPTO:"<<"\n"<<"\n"<<"2nd week of January 2015"<<"\n"<<"\n";
  87.         cout<<"                       \n * CLASSES SCHEDULE:"<<"\n"<<"\n"<<"3-4 days a week"<<"\n"<<"\n"<<"Regular classes : 3-4 hours per day"<<"\n"<<"\n"<<
  88.                             "Saturday & Sunday : 6 hours each"<<"\n"<<"\n";
  89.         cout<<"                       \n * ADMISSION:"<<"\n"<<"\n"<<"Direct"<<"\n"<<"\n";
  90.         cout<<"                       \n * ELIGIBILITY:"<<"\n"<<"\n"<<"Class XII studying students"<<"\n"<<"\n";
  91.  
  92.     }
  93.  
  94. }
  95. void cen()
  96. {
  97.  cout<<"\n Coming Soon!!!";
  98.  }
  99.  
  100. void main()
  101. {
  102.     sinfo g;
  103.     int choice,d,c,i;
  104.     ifstream fin;
  105.     fin.open("About.txt",ios::in);
  106.     if(fin.eof())
  107.     cout<<"\n To get started, please choose from the below:"<<"\n"<<"\n"<<"\n"<<"\n";// display this after the end of the file.
  108.     fin.close();cout<<"\n";
  109.  
  110. lb:
  111.     cout<<"      \n 1. About XYZ"//INformation
  112.     <<"      \n 2. General Information"
  113.     <<"      \n 3. Terms and conditions"
  114.     <<"     \n 4. Nationwide Centers"
  115.     <<"      \n 5. Exit"
  116.     <<"      \n 6. Admission";
  117.     cout<<"\n Enter your choice";
  118.     cin>>choice;
  119.     switch(choice)
  120.     {
  121.     case 1:
  122.        cb: cout<<"\n 1. Classroom courses for Engineering 2014-2015:";//about
  123.            cout<<"\n 2. Classroom courses for Medical 2014-2015";//"
  124.            cout<<"\n 3. Admission Process";//about admission
  125.            cout<<"\n Press 0(zero) to go back to main menu:";
  126.            cin>>c;
  127.            switch(c)
  128.            {
  129.            case 1: void eng();
  130.                break;
  131.            case 2: void med();
  132.  
  133.                break;
  134.            case 3: void adm();
  135.                goto cb;
  136.                break;
  137.            case 0: goto lb;
  138.                break;
  139.            default: cout<<"\n Invalid Choice... Please Enter again:";
  140.  
  141.            }
  142.            break;
  143.     case 2:
  144.          gb:cout<<"\n 1. Fee and Office Timings";
  145.         cout<<"\n 2. Service Tax";
  146.         cout<<"\n 3. Refund Policy for Classroom Courses";
  147.         cout<<"\n 4. Holidays";
  148.         cout<<"\n Press 0(zero) for main menu:";
  149.         cin>>d;
  150.         switch(d)
  151.         {
  152.             case 1: void fee();
  153.                 goto gb;
  154.                 break;
  155.             case 2: void serv();
  156.                 goto gb;
  157.                 break;
  158.             case 3: void ref();
  159.                 goto gb;
  160.                 break;
  161.             case 4: void hol();
  162.                 break;
  163.                 goto gb;
  164.             case 0: goto lb;
  165.                 break;
  166.             default: cout<<"\n Invalid Choice.... Please Enter again:";
  167.  
  168.         }
  169.         break;
  170.     case 3: void terms();
  171.         cout<<"\n Press 0(zero) for main menu:";
  172.         cin>>i;
  173.         if(i==0)
  174.         goto lb;
  175.         else
  176.         cout<<"\n Wrong option!"
  177.             <<"\n Press 0(zero) for main menu:";
  178.  
  179.         break;
  180.  
  181.  
  182.  
  183.     case 4: cout<<"\n Coming Soon!!!"<<endl;
  184.         cout<<"\n Press 0(zero) for main menu:";
  185.         cin>>i;
  186.         if(i==0)
  187.         goto lb;
  188.         else
  189.         cout<<"\n Wrong option!"
  190.             <<"\n Press 0(zero) for main menu:";
  191.  
  192.         break;
  193.     case 5: exit(0);
  194.         break;
  195.     case 6:  clrscr();
  196.          g.input();
  197.          break;
  198.     default: cout<<"\n Invalid Choice...";
  199.          goto lb;
  200.  
  201.  
  202.  
  203.     }
  204.  
  205. }
  206.  
Aug 5 '14 #1
4 1083
donbock
2,426 Expert 2GB
What errors are you getting?
Aug 5 '14 #2
weaknessforcats
9,208 Expert Mod 8TB
Expand|Select|Wrap|Line Numbers
  1.     int d; <<<<<<<<!!!!!!
  2.     void cinfo();
  3.     cout << "\n Enter your name:";
  4.     filn.getline(form.sname, 20);
  5.     cout << "\n Enter contact information:";
  6.     filc.getline(form.contact, 12);
  7.     cout << "\n Enter Address:";
  8.     fila.getline(form.addr, 30);
  9.     cout << "\n Enter date of birth:(DD/MM/YYYY)";
  10.     for (int i = 0; i <= 2; i++)
  11.     {
  12.         cin >> d[i]; <<<<<<<!!!!!!!
  13.     }
The variable d is not an array.

Don't use clrscr unless you have the code for it. This is a nonstandard function.

You have the class sinfo defined twice.

The class declarations are missing the terminating semi-colon.

Next time, compile as you go. Start with:

Expand|Select|Wrap|Line Numbers
  1. class sinfo
  2. {
  3.  
  4. };
  5. int main()
  6. {
  7.  
  8. }
  9.  
and verify this compiles. Then add some code and recompile. Verify the code compiles. This way if your code does not compile you will know it's in the last bit you added. Writing 1200 lines of code and getting tons of errors is not the way to go.
Aug 5 '14 #3
Unreachable Code in all the Goto statements.
Aug 6 '14 #4
But the semi-colon is there after the class declarations.
Aug 6 '14 #5

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

Similar topics

9
by: Erwin Moller | last post by:
Hi group, I have this very annoying problem during development: the linenumbers PHP says contain a error/warning/notice are completely wrong. When? When I use includes and make a mistake. ...
2
by: iainw | last post by:
HI All, 1st post here, i wonder if you can help. We are about to upload CMS t a windows server and keep getting 2 errors below. We need to go LIVE an it's delaying us. An error occured when...
15
by: Walter Dnes (delete the 'z' to get my real address | last post by:
A long time ago, in a place far away, there was an OS called DOS that had standard numeric return codes. Regardless of the programming language used, the same error return codes were supposed to...
2
by: Rajshekhar | last post by:
Hi all, Where can i get the complete details about the all types of errors and warnings that a C-compiler pops up..?? any pdfs or links or books to refer....! plz help me out.. Regards,...
6
by: Brett | last post by:
Not sure what the problem is here... Trying to update from a datagrid to an access database using vb.net... Its not updating the database but Im not getting any errors... Here is my code... ...
4
by: A Palmblad | last post by:
We're having a lot of trouble with one of our new servers. It's an AMD64 dual cpu system, running on Gentoo Linux, with kernel 2.6.7. Data is stored on a JFS partition. Before we installed the...
1
by: | last post by:
I'm having a problem finding the cause for this problem. I have a solution in Visual Studio 2005 that contains two projects -- a Web Site and a Class Library. The web site references the class...
4
by: vijaybabudev81 | last post by:
Hi, I want to get the error & warnings messages from program. like fatal error, variable declaration error in strict mode & etc.. is it possible in perl? plz give your suggestions. Thanks...
2
jhardman
by: jhardman | last post by:
I keep getting connection errors that appear to me to relate to user permissions. I tried connecting with DSN from both a classic ASP page using VBScript, and from a .NET web service using C#,...
2
by: tam13 | last post by:
I get two error when I try to compile my code. For this line: if(it->getName == nam) it tells me (No match for the 'operator=='in it.std::_List_Iterator<TP>::operator ->0->record::getName==nam...
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: 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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
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.