Please send me some works!!!

This is a discussion on Please send me some works!!! within the C++ Programming forums, part of the General Programming Boards category; Hi guys, I'm a newbie and I have just learned a little about C++ Programming. I have learned all the ...

  1. #1
    Registered User
    Join Date
    Jul 2010
    Posts
    3

    Talking Please send me some works!!!

    Hi guys,
    I'm a newbie and I have just learned a little about C++ Programming. I have learned all the 'if, switch, while, do, etc'. The lesson that I'm stucking in is the Functions. Could you please give me some works about functions to do, so that I could improve my C++ in functions. And if you have any more C++ works, please send to me. My email address is: <<snipped>>. Thank you very much for your help!!!
    Blackhawk

  2. #2
    Your imaginary friend
    Join Date
    Jan 2010
    Location
    Canada
    Posts
    76
    A function is basicly a variable(void included) that does different things.

    A simple example:
    Code:
    void say_hello(){cout<<"Hello!"}
    True, this is a very, extremely, simple function but you could do them as long as you wish/need(as this is only a one function, function)
    Once the "blueprint"is writen(example of a blueprint given) all you have to do is write the name and it will do whatever it is programmed for(cout'ting hello!) as in

    Code:
    void say_hello(){cout<<"Hello!"}
    
    main(){say_hello(); //will cout "Hello!"}
    Last edited by jerimo; 07-16-2010 at 02:59 PM. Reason: fixing the second code part

  3. #3
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,602
    Quote Originally Posted by blackhawk65
    The lesson that I'm stucking in is the Functions. Could you please give me some works about functions to do, so that I could improve my C++ in functions.
    There is a tutorial here on functions, with many more available elsewhere. Have you read it?

    Quote Originally Posted by jerimo
    A function is basicly a variable(void included) that does different things.
    Personally, although there are variables of function pointer type, I do not think that it helps to think of a function as a variable that does different things. The idea of functions as "blocks of code that perform a number of pre-defined commands to accomplish something productive" seems more productive for a beginner, along with the idea that these blocks of code can be called from other blocks of code by using the function's name with zero or more arguments.

    Quote Originally Posted by jerimo
    But you are already using function(you just don't know it)

    "if" is a function
    if/* the name*/(/*the objects(information transmited, optional)*/){
    /*the things to execute*/
    Err... no, an if statement is not a function.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  4. #4
    Your imaginary friend
    Join Date
    Jan 2010
    Location
    Canada
    Posts
    76
    Kind of(it acts somewhat in the same way)

  5. #5
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,602
    Quote Originally Posted by jerimo
    Kind of(it acts somewhat in the same way)
    No, it does not. You cannot "call" an if statement in the same way as you can for a function.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  6. #6
    Your imaginary friend
    Join Date
    Jan 2010
    Location
    Canada
    Posts
    76
    i was...writing... syntax wise not actualy calling it(anyhow I'll edit)

  7. #7
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    ..and there is no stack frame setup for an if like there is for a call.

  8. #8
    Your imaginary friend
    Join Date
    Jan 2010
    Location
    Canada
    Posts
    76
    Any how I edited out, let's just say I had a brain-fart

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Client works on a LAN but don't send all the data
    By Niara in forum Networking/Device Communication
    Replies: 9
    Last Post: 01-04-2007, 03:44 PM
  2. Socket or send() problem?
    By Achy in forum C Programming
    Replies: 5
    Last Post: 06-09-2006, 01:09 PM
  3. More Efficient Message Send
    By jmd15 in forum Windows Programming
    Replies: 4
    Last Post: 05-12-2006, 04:53 PM
  4. socket send() exits app unexceptively
    By Kleid-0 in forum C Programming
    Replies: 9
    Last Post: 07-25-2005, 08:29 AM
  5. Send and receive through serial Port
    By overspray in forum C++ Programming
    Replies: 1
    Last Post: 07-21-2004, 04:15 PM

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