Thread: Newed Help

  1. #1
    Tyreal
    Guest

    Question Newed Help

    Here is my code and i have some errors like main not valid can someone tell me whats wrong...


    I have been programming in OpenGL and WinAPI I forgot the Very Basics of why this could be wrong...

    Let me know plz!


    #include <iostream.h>
    #include <math.h>
    //////////////////////////
    // Constants //
    // AKA //
    // Global Var's //
    //////////////////////////
    #define PI 3.1415926535f
    //////////////////////////
    // Functions //
    //////////////////////////
    basicinit(double a)
    {
    cout<<a<<endl;
    return 0;
    };
    squareinit(double a)
    {
    if (a < 0)
    {
    cout<<"Complex Number detected";
    return 0;
    }
    cout<< sqrt(a);
    return 0;
    };
    exponentsinit(double a, double b)
    {
    if (b == 0)
    {
    cout<<"1"<<endl;
    return 0;
    }
    if (b == 1)
    {
    cout<<a<<endl;
    return 0;
    }
    if (b < 0)
    {
    if (b == -1)
    {
    cout<<"0"<<endl;
    }
    for( b = b + 1; b >= 0; b++)
    {
    cout<<a / a<<endl;
    }
    for ( b = b - 1; b <= 0; b--)
    {
    cout<<a * a<<endl;
    }

    return 0;
    };

    //////////////////////////
    // Main Function //
    //////////////////////////
    int main()
    {
    //////////////////////////
    // Variablles //
    //////////////////////////
    const i = sqrt(-1.0f);
    double x;
    double y;
    double z;
    int choose;
    //////////////////////////
    // To Do //
    //////////////////////////
    cout<<"Choose from menu"<<endl;
    cout<<"1. Basic Arithmatic\n"
    <<"2. Square roots\n"
    <<"3. Exponents"<<endl;
    cin>>choose;
    if (choose == 1)
    {
    cout<<"Please input expression\n"
    <<"Make Sure that there is only one variable and it is on the lone side of the equal\n"
    <<"EXAMPLE: 1*2+3-2"<<endl;
    cin>>x;
    basicinit(x, NULL, NULL);
    }
    if (choose == 2)
    {
    cout<<"INsert the number you want to squeare root\n";
    cin>>x;
    squareinit(x);
    }
    if ( choose == 3)
    {
    cout<<"Enter the number you want to raise exponent then write the number you want to raise it to\n"
    <<"Example First: 2 Second: 2 answer is 4 because 2 squared is 4"
    <<"First: ";
    cin>>x;
    cout<<"\nSecond: ";
    cin>>y;
    exponentsinit(x,y);
    }


    return 0;
    }

  2. #2
    Tyrael
    Guest

    oops

    Oops, I accidently Ctrl-V'ed Twice

  3. #3
    Registered User
    Join Date
    Sep 2001
    Posts
    18

    I Registered

    read subject of reply
    HACKERS MANIFESTO (NOTE MOST WAS CUT OFF) (PEOPLE SAID IT WAS TOO LONG)
    This is our world now... the world of the electron and the switch, the beauty of the baud.
    · We make use of a service already existing withoutpaying for what could be dirt-cheap if it wasn't run by profiteering gluttons, and you call us criminals.
    · We explore... and you call us criminals.
    · We seek after knowledge... and you call us criminals.
    · We exist without skin color, without nationality, without religious bias... and you call us criminals.
    · You build atomic bombs, you wage wars, you murder, cheat, and lie to us and try to make us believe it's for our own good, yet we're the criminals.

    Yes, I am a criminal. My crime is that of curiosity. My crime is that of judging people by what they say and think, not what they look like. My crime is that of outsmarting you, something that you will never forgive me for.

    I am a hacker, and this is my manifesto. You may stop this individual,but you can't stop us all... after all, we're all alike.
    +++The Mentor+++

  4. #4
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    Umm... You might want to go back and study C++ again before continuing on with OpenGL and WinAPI.

    Here are a few of the problems:
    - None of your functions have a return type specified. In this case, they should all be 'int' since you are attempting to return 0.
    - You have a semicolon after the last brace of one of your functions.
    - You have no 'main'.

  5. #5
    Registered User
    Join Date
    Sep 2001
    Posts
    18

    R U KDDING?

    Umm, I have been programming OpenGL and Windows for at least 9 Months and I am very Excellent at it... I am currently working on a game called Dark Scape...

    Read about it earlier in the Forum...............
    HACKERS MANIFESTO (NOTE MOST WAS CUT OFF) (PEOPLE SAID IT WAS TOO LONG)
    This is our world now... the world of the electron and the switch, the beauty of the baud.
    · We make use of a service already existing withoutpaying for what could be dirt-cheap if it wasn't run by profiteering gluttons, and you call us criminals.
    · We explore... and you call us criminals.
    · We seek after knowledge... and you call us criminals.
    · We exist without skin color, without nationality, without religious bias... and you call us criminals.
    · You build atomic bombs, you wage wars, you murder, cheat, and lie to us and try to make us believe it's for our own good, yet we're the criminals.

    Yes, I am a criminal. My crime is that of curiosity. My crime is that of judging people by what they say and think, not what they look like. My crime is that of outsmarting you, something that you will never forgive me for.

    I am a hacker, and this is my manifesto. You may stop this individual,but you can't stop us all... after all, we're all alike.
    +++The Mentor+++

  6. #6
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    I am not commenting on your knowledge of OpenGL or WinAPI. I was just suggesting that you may have an easier time with your projects if you are better at avoiding (and detecting) simple errors such as these.

Popular pages Recent additions subscribe to a feed