whats wrong with this?

im having trouble with it. i dont know whats wrong. HELP!!!#include

#include

int main()

(

int rand;

int guess;

int rand=rand(100)

(

cout<<"this is a game where you try to guess the number.";

cout<<"i will tell you if you'r to high or to low";

cout<<"ready.....";

system<<"pause";

cout<<"GO!!!";

do

{

{

cout<<"input your guess";

}

if(guess>rand)

{

cout<<"to high";

}

else if(guess==rand)

{

cout<<"YAY YOU WIN!";

}

else

{

cout<<"wrong";

)

)while(guess!=rand);

return 0

}

i have no idea and i fixed as many of the errors that i could. I am using Dev-C++. I am a newb so explain it nicely please. if you want, you can E-mail me at gamedjinn@msn.com


Comments

  • : im having trouble with it. i dont know whats wrong. HELP!!!
    [code]
    #include
    #include
    #include

    int main ()
    (
    [b]// Initialize, so every time it will be different:[/b]
    srand (time (0));

    int guess;
    int random = rand (100);

    cout << "this is a game where you try to guess the number.";
    cout << "i will tell you if you'r too high or too low";
    cout << "ready.....";
    system ("pause");
    cout << "GO!!!";

    do {
    cout << "Input your guess: ";
    cin >> guess;

    if (guess == random) {
    cout << endl;
    cout << "***** YAY YOU WIN! *****";
    break; [b]// Get out of 'do()'[/b]
    }

    if (guess > random) {
    cout << "-- too high --" << endl;
    }
    else {
    cout << "-- too low --" << endl;
    }
    } while (guess != random);

    return 0;
    }
    [/code]

  • : : im having trouble with it. i dont know whats wrong. HELP!!!
    : [code]
    : #include
    : #include
    : #include
    :
    : int main ()
    : (
    : [b]// Initialize, so every time it will be different:[/b]
    : srand (time (0));
    :
    : int guess;
    : int random = rand (100);
    :
    : cout << "this is a game where you try to guess the number.";
    : cout << "i will tell you if you'r too high or too low";
    : cout << "ready.....";
    : system ("pause");
    : cout << "GO!!!";
    :
    : do {
    : cout << "Input your guess: ";
    : cin >> guess;
    :
    : if (guess == random) {
    : cout << endl;
    : cout << "***** YAY YOU WIN! *****";
    : break; [b]// Get out of 'do()'[/b]
    : }
    :
    : if (guess > random) {
    : cout << "-- too high --" << endl;
    : }
    : else {
    : cout << "-- too low --" << endl;
    : }
    : } while (guess != random);
    :
    : return 0;
    : }
    : [/code]
    :
    :



    Ok. i copied and pasted it into my compiler. It STILL doesnt work. infact im getting more errors than i was. i will copy past them in.........

    31 C:DEV-CPPincludec++ackwardiostream.h
    In file included from C:/DEV-CPP/include/c++/backward/iostream.h

    1 C:Dev-CppTemplates
    andnumb.cpp
    from Templates/randnumb.cpp

    2 C:DEV-CPPincludec++ackwardackward_warning.h:32
    #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the header for C++ includes, or instead of the deprecated header . To disable this warning use -Wno-deprecated.

    8 C:Dev-CppTemplates
    andnumb.cpp
    parse error before `;' token

    11 C:Dev-CppTemplates
    andnumb.cpp
    `main' declared as function returning a function

    13 C:Dev-CppTemplates
    andnumb.cpp
    syntax error before `<<' token
    (3 of these)

    16 C:Dev-CppTemplates
    andnumb.cpp
    ISO C++ forbids declaration of `system' with no type

    16 C:Dev-CppTemplates
    andnumb.cpp
    `int system' redeclared as different kind of symbol

    373 C:DEV-CPPincludestdlib.h
    previous declaration of `int system(const

    16 C:Dev-CppTemplates
    andnumb.cpp
    invalid conversion from `const char*' to `int'

    21 C:Dev-CppTemplates
    andnumb.cpp
    syntax error before `>>' token

    25 C:Dev-CppTemplates
    andnumb.cpp
    syntax error before `<<' token

    G__~1.EXE C:Dev-CppG__~1.EXE
    Templates/randnumb.o: No such file or directory.

    G__~1.EXE C:Dev-CppG__~1.EXE
    no input files

    ok thats it

    alot more than the 3 i had......

    if you could fix these and explain it i'd be VERY grateful

    TIA
    gamedjinn



  • Start with this instead

    [code]
    #include
    #include
    #include

    using namespace std;
    [/code]

    Regarding the error about system() taking an int as first parameter, you have to refer to your manual.

    Hope This Helps


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories