Menu

A little HELP!?!?!?!?!?!?

Anonymous
2002-05-23
2012-09-26
  • Anonymous

    Anonymous - 2002-05-23

    For some reason while compiling my source I get a parce error at the end of my code. the only thing on the line is the final bracket I will put the int main( ) below can someone tell me why this parse error keeps happening it is the only line in my source that has and error and I want to get to the debugging process but I need to get past this and I am stumped. Thanx for your help in advance.

    int main();
    { char k;
    cout<<"********Welcome to EXPERMENT PROGRAM 1 *********************";
    cin>>k;
    if (k=(char)"2")
    { login();
    }
    else
    { signup();}
    } (<----------Here On this line is the error it is a 66
    parse error at end of input)

     
    • Charles Manson

      Charles Manson - 2002-07-29

      Hello John.

      Well from what i can see, the reason you are getting a parser error is because you have a semicolon (;) at the end
      of ' int main()'. Simply remove it and it should work fine.

      PS:
      Btw, couldn't help to notice but, on the line:

      if(k=(char)"2")

      you are assigning the value to to the variable 'k', not testing for  equality.  Im guessing you want to see if
      the user has entered 2, and the do the login code.
      Use the '==' operator instead.
      Just wanted to point that out. Hope this helps you out!
      Good Luck!

       
    • Anonymous

      Anonymous - 2002-08-14

      if(k=(char)"2")
      assignment that should be
      if(k==(char)"2")
      like jackrabbit said, but "2" is a pointer to a string containing 2. You are casting the pointer to char, so it won't work as you want. It should be:
      if(k=='2')

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.