Thread: parse error

  1. #1
    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,090
    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,897
    >while (main !=0)
    What are you trying to do with this?
    My best code is written with the delete key.

  4. #4
    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, 02: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, 05:45 AM
  5. Couple C questions :)
    By Divx in forum C Programming
    Replies: 5
    Last Post: 01-28-2003, 01:10 AM