i have no idea what wrong

This is a discussion on i have no idea what wrong within the C++ Programming forums, part of the General Programming Boards category; i know im doing the function wrong in the (stuff) i have hilighted it in red and ther is some ...

  1. #1
    Registered User
    Join Date
    Jun 2005
    Posts
    47

    i have no idea what wrong

    i know im doing the function wrong in the (stuff) i have hilighted it in red and ther is some other stuff but can people tell me what im doing wrong?
    Code:
    #include <iostream>
    
    using namespace std;
    
    int colorred,colorgreen,colorblue;
    int x = 36;
    void squeee( colorred,colorgreen,colorred )
    {
        while ( x >= 0 )
        {
            oout<<"<font color="<<colorred<<colorgreen<<colorblue<<">e</font>;
            if ( colorblue == 99 )
            {
                 colorgreen --;
            }
            else if ( colorred == 00 )
            {
                 colorblue ++;
            }
            else if ( colorgreen == 99 )
            {
                 colorred --;
            }
            else
            {
                colorgreen ++;
            }
            x --;
            }
        system("pause");
        }
    
    int main()
    {
        squeee(99,00,00)
    }

  2. #2
    ------------
    Join Date
    Jun 2005
    Posts
    79
    yay! something i think i can help! ok, in the beginning you have:
    Code:
    int colorred,colorgreen,colorblue;
    but then you have:
    Code:
    void squeee( colorred,colorgreen,colorred )
    so colorblue isnt declaired... you put colorred twice in the 2nd one

    edit:
    oops... i didnt understand your question completely... i dont know anything else with it but i'm new to c++ so i wouldnt exactly know much anyways...
    Last edited by Goosie; 06-22-2005 at 01:43 PM. Reason: im an idiot
    CAUTION: Newbie at programming!
    -------------------------------------------------
    Thanks everyone who helped me with all the questions, and utter lost-ness i happen to have... it is VERY VERY much appreciated

  3. #3
    Registered User
    Join Date
    Apr 2003
    Posts
    2,662
    1)Get rid of this:

    int colorred,colorgreen,colorblue;

    2)Put this:

    int x = 36;

    inside your function.

    3) All statements in C++ must end with a semi-colon:

    squeee(99,00,00)


    4) The number zero is written as 0 not 00.

    5) When you define a function, you have to list the types of the parameters--those are the things you colored maroon. When you send values to a function:

    squeee(99,00,00);

    the values are stored in the parameter variables(the things that are maroon). Therefore, you have to declare the type of the parameter variables, AND you have to send the function values that match the types.

    6) Take this out of your function:

    system("pause");

    and put it in main().

    7)
    oout<<"<font color="<<colorred<<colorgreen<<colorblue<<">e</font>;

    8) Add:

    return 0;

    as your last statement in main() for every program.
    Last edited by 7stud; 06-22-2005 at 02:06 PM.

  4. #4
    myNegReal
    Join Date
    Jun 2005
    Posts
    100
    Code:
    oout<<"<font color="<<colorred<<colorgreen<<colorblue<<">e</font>;
    The oout there should aslo be cout. And you need a ending quote after the last string:
    ">e</font>"
    Code:
    cout<<"<font color="<<colorred<<colorgreen<<colorblue<<">e</font>";

  5. #5
    Registered User
    Join Date
    Apr 2003
    Posts
    2,662
    ..beat me to it.

  6. #6
    ------------
    Join Date
    Jun 2005
    Posts
    79
    ^wow... its bad how i didnt reolize ANY of those errors... well, i tried... lol
    CAUTION: Newbie at programming!
    -------------------------------------------------
    Thanks everyone who helped me with all the questions, and utter lost-ness i happen to have... it is VERY VERY much appreciated

  7. #7
    *this
    Join Date
    Mar 2005
    Posts
    498
    Code:
    void squeee(int colorred, int colorgreen, int colorblue ) //missing values!!!!!

  8. #8
    Dae
    Dae is offline
    Deprecated Dae's Avatar
    Join Date
    Oct 2004
    Location
    Canada
    Posts
    1,034
    Quote Originally Posted by JoshR
    Code:
    void squeee(int colorred, int colorgreen, int colorblue ) //missing values!!!!!
    Wow, I saw that when I visited the topic before, but quickly glancing at Goosie's reply I though it was already corrected., (if not the other 3 replies) ahaha.
    Warning: Have doubt in anything I post.

    GCC 4.5, Boost 1.40, Code::Blocks 8.02, Ubuntu 9.10 010001000110000101100101

  9. #9
    myNegReal
    Join Date
    Jun 2005
    Posts
    100
    Quote Originally Posted by JoshR
    Code:
    void squeee(int colorred, int colorgreen, int colorblue ) //missing values!!!!!
    Wow, I saw that when I visited the topic before, but quickly glancing at Goosie's reply I though it was already corrected., (if not the other 3 replies) ahaha.
    Yeah, 7stud said it, he just did say it so explicitly with the code.
    5) When you define a function, you have to list the types of the parameters--those are the things you colored maroon. When you send values to a function:

    squeee(99,00,00);

    the values are stored in the parameter variables(the things that are maroon). Therefore, you have to declare the type of the parameter variables, AND you have to send the function values that match the types.

  10. #10
    *this
    Join Date
    Mar 2005
    Posts
    498
    i guess you were trying to get him to understand the parameter variables etc....

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. An idea that's out of my reach of knowledge
    By Akkernight in forum Tech Board
    Replies: 12
    Last Post: 04-08-2009, 09:35 PM
  2. Have an idea?
    By B0bDole in forum Projects and Job Recruitment
    Replies: 46
    Last Post: 01-13-2005, 02:25 PM
  3. An Idea I have...
    By TechWins in forum Tech Board
    Replies: 1
    Last Post: 07-25-2003, 05:49 AM
  4. God
    By datainjector in forum A Brief History of Cprogramming.com
    Replies: 746
    Last Post: 12-22-2002, 11:01 AM
  5. Just an idea >?<
    By Cgawd in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 10-30-2002, 08:08 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21