parse error

This is a discussion on parse error within the C++ Programming forums, part of the General Programming Boards category; Authough my complier (Bloodshes dev-C++) has found a parse error before else I cannot work out how to fix this ...

  1. #1
    jrk
    jrk is offline
    Registered User
    Join Date
    Dec 2003
    Posts
    2

    Exclamation parse error

    Authough my complier (Bloodshes dev-C++) has found a parse error before else I cannot work out how to fix this
    Code:
        
    int main(int argc, char *argv[])
    {
      while (main !=0)
      {
        long samsiz;
        long varsiz;
        cout<< "to begin press:" << endl;
        cout<< "1 for a rectangle"<<endl<<"0 for quit"<<endl;
        cin>> type;
        if (type == 1);
        {
          cout<<"You have selected rectangle" << endl;
          cout<<"What is the fixed length?" << endl;
          cin>>samsiz;
          if (samsiz == 5);
          {
            cout<<"you have selected 5" << endl;
            cout<<"what is the variable size"<<endl;
            cin>>varsiz;
            varsiz=varsiz-1;
            cout<<"The difference between diagnal corners is " << varsiz*40<<endl;
          }
        }
        else
        {
         return 0;
        }
       }
     }

  2. #2
    Registered User jlou's Avatar
    Join Date
    Jul 2003
    Posts
    1,088
    Don't put semicolons after the if.
    Code:
    if (type == 1); <--- remove that semicolon
    You did it more than once. Also, type is not declared.

  3. #3
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >while (main !=0)
    What are you trying to do with this?
    My best code is written with the delete key.

  4. #4
    jrk
    jrk is offline
    Registered User
    Join Date
    Dec 2003
    Posts
    2
    thankyou for the help

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling sample DarkGDK Program
    By Phyxashun in forum Game Programming
    Replies: 6
    Last Post: 01-27-2009, 03:07 AM
  2. How to monitor process creation?
    By markiz in forum Windows Programming
    Replies: 31
    Last Post: 03-17-2008, 03:39 PM
  3. Using VC Toolkit 2003
    By Noobwaker in forum Windows Programming
    Replies: 8
    Last Post: 03-13-2006, 07:33 AM
  4. C++ compilation issues
    By Rupan in forum C++ Programming
    Replies: 1
    Last Post: 08-22-2005, 06:45 AM
  5. Couple C questions :)
    By Divx in forum C Programming
    Replies: 5
    Last Post: 01-28-2003, 01:10 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21