Thread: Arguments

  1. #1
    Registered User
    Join Date
    Sep 2010
    Posts
    12

    Arguments

    Hi, i'm new to c++. I understand the idea of functions, and i know that i have to declare them as rand. I think that you have to declare an argument, but i find the tutorial a little hazy. At the minute i am experimenting with the example on the switch/case page, which i have to declare playgame, loadgame and playmultiplayer as functions. I have declared them as rand's but it says it takes 0 argument, so i don't know what to type. Any advice?

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by ftball22
    I understand the idea of functions, and i know that i have to declare them as rand.
    What do you mean by "declare them as rand"?

    Quote Originally Posted by ftball22
    I think that you have to declare an argument, but i find the tutorial a little hazy. At the minute i am experimenting with the example on the switch/case page, which i have to declare playgame, loadgame and playmultiplayer as functions. I have declared them as rand's but it says it takes 0 argument, so i don't know what to type. Any advice?
    What is your current code? Post it in [code][/code] bbcode tags.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Sep 2010
    Posts
    12
    if you have a look at functions in the C++ tutorial, there it describes the functions as rand. I would show you the code, but I'm on the family computer and not my laptop, which is where the program is. I'll post it on in the morning, if you wouldn't mind look then.

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by ftball22
    if you have a look at functions in the C++ tutorial, there it describes the functions as rand.
    Looking at the tutorial on functions, I see that rand is cited as an example of a function, but the tutorial certainly does not describe "the functions as rand".
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. GradeInfo
    By kirksson in forum C Programming
    Replies: 23
    Last Post: 07-16-2008, 03:27 PM
  2. command line arguments
    By vurentjie in forum C Programming
    Replies: 3
    Last Post: 06-22-2008, 06:46 AM
  3. Replies: 10
    Last Post: 09-27-2005, 12:49 PM
  4. NULL arguments in a shell program
    By gregulator in forum C Programming
    Replies: 4
    Last Post: 04-15-2004, 10:48 AM
  5. registry, services & command line arguments.. ?
    By BrianK in forum Windows Programming
    Replies: 3
    Last Post: 03-04-2003, 02:11 PM