Thread: I tried to compiler this in Dev-C++ v5.0 but it won't work. Help please

  1. #1
    Registered User
    Join Date
    Aug 2002
    Posts
    67

    I tried to compiler this in Dev-C++ v5.0 but it won't work. Help please

    Code:
    #include <iostream.h>
    #include <stdlib.h>
    int main()
    {
    cout<<"Welcome to Tic-Tac-Toe\n";
    cout<<"What do you wish to do?\n";
    cout<<"1.New Game\n";
    cout<<"2.Options\n";
    cout<<"3.Quit\n";
    int mainmenunumber;
    int difficulty;
    cin>>mainmenunumber;
    if (mainmenunumber=2)
    {
    system("CLRSCR");
    cout<<"Welcome to the Options Menu\n";
    cout<<"1.Difficulty\n";
    cout<<"2.Back\n";
    int optionsmenu;
    cin>>optionsmenu
    if (optionsmenu=1)
    {
    system("CLRSCR");
    cout<<"What difficulty lvl do you want?";
    }
    system("PAUSE");
    return 0;
    }
    Does anyone notice any problems?

    [edit]Nice try with the code tags, you used the wrong slash though. I've changed it for now. Hammer.

  2. #2
    geek SilentStrike's Avatar
    Join Date
    Aug 2001
    Location
    NJ
    Posts
    1,141
    What does the compiler say?
    Prove you can code in C++ or C# at TopCoder, referrer rrenaud
    Read my livejournal

  3. #3
    Registered User
    Join Date
    Aug 2002
    Posts
    67
    1 parse error before `--'

    31 In file included from C:/DEV-CPP/include/g++-3/iostream.h

    2 from Source.cpp

    37 parse error before `}'

    [Warning] In function `int main()':

    22 parse error before `if'

    those are all the errors

  4. #4
    Registered User
    Join Date
    Aug 2002
    Posts
    67
    So no one knows?

  5. #5
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    to check for equality use operator ==
    to assign something to something else use operator =

    Now you work it out!
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  6. #6
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    also a cin>> is missing a semicolon
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  7. #7
    Registered User
    Join Date
    Aug 2002
    Posts
    67
    Okay I fixed it
    Code:
    #include <iostream.h>
    #include <stdlib.h>
    int main()
    {
    cout<<"Welcome to Tic-Tac-Toe\n";
    cout<<"What do you wish to do?\n";
    cout<<"1.New Game\n";
    cout<<"2.Options\n";
    cout<<"3.Quit\n";
    int mainmenunumber;
    int difficulty;
    cin>>mainmenunumber;
    if (mainmenunumber==2)
    {
    system("CLRSCR");
    cout<<"Welcome to the Options Menu\n";
    cout<<"1.Difficulty\n";
    cout<<"2.Back\n";
    int optionsmenu;
    cin>>optionsmenu;
    if (optionsmenu==1)
    {
    system("CLRSCR");
    cout<<"What difficulty lvl do you want?";
    }
    system("PAUSE");
    return 0;
    }
    But It still wont work. It says there is a error at the end of input

  8. #8
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    is the system call right?
    what operating system?
    try
    system("CLS");
    instead.
    other than that with quick glance code looks good.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  9. #9
    Registered User
    Join Date
    Aug 2002
    Posts
    67

    Unhappy

    I changed it to CLS but I am still getting a error at the end of input...

  10. #10
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    what says theres an error at end of input?
    compiler?
    when you type input running it?
    be more specific about whats happening
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  11. #11
    Registered User
    Join Date
    Aug 2002
    Posts
    67
    Okay, I compiler the code. The complier says there is a error at the end of input. On line uh...like one line after the last '}'.

  12. #12
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    some compilers like a newline at the end of the file. type a return after the last brace
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  13. #13
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    If you just count your brackets, you'll see there's too few of them...if you'd just concentrate, you'll knock out these sorts of errors quickly, otherwise you're just wasting your time being helpless.
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  14. #14
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    your missing a brace too
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  15. #15
    Registered User
    Join Date
    Aug 2002
    Posts
    67

    Unhappy

    Sebastiani is a friendly person..
    Thanks for your help Stoned_Coder

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Weird compiler (Dev)
    By gavra in forum C Programming
    Replies: 11
    Last Post: 08-03-2008, 01:19 AM
  2. Internal Compiler Error
    By Elysia in forum C++ Programming
    Replies: 20
    Last Post: 07-05-2008, 03:59 AM
  3. New to Dev C++/<windows.h>...
    By Cilius in forum C++ Programming
    Replies: 3
    Last Post: 02-23-2005, 01:05 AM
  4. Replies: 3
    Last Post: 02-11-2005, 05:53 AM
  5. why does'nt this work..
    By morone in forum C++ Programming
    Replies: 2
    Last Post: 10-20-2001, 01:07 AM