Thread: Call To A Function Demo

  1. #1
    Registered User
    Join Date
    Jan 2005
    Posts
    7

    Call To A Function Demo

    This is a demonstration on how call to a function works, and I seem to have a parse error before "}"

    Here is the code:
    Code:
    #include <iostream>
    
    //function demonstrating a call to a function
    //prints out a useful message
    void DemonstrationFunction()
     {
     std::cout << "In Demonstration\n";
     }
    
    //function main - prints out message then
    //calls DemonstrationFunction, then prints out
    //a second message
    int main()
     {
     std::cout <<"In Main\n";
     DemonstrationFunction();
     std::cout << "Back In Main\n";
     return 0
     }

  2. #2
    Handy Andy andyhunter's Avatar
    Join Date
    Dec 2004
    Posts
    540
    Code:
    return 0;
    you forgot your semicolon.
    i don't think most standard compilers support programmers with more than 4 red boxes - Misplaced

    It is my sacred duity to stand in the path of the flood of ignorance and blatant stupidity... - quzah

    Such pointless tricks ceased to be interesting or useful when we came down from the trees and started using higher level languages. - Salem

  3. #3
    Registered User
    Join Date
    Jan 2005
    Posts
    7
    ah how did I miss that...well I'm a beginner anyways. thanks for the help, I really appreciate it man.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Undefined Reference Compiling Error
    By AlakaAlaki in forum C++ Programming
    Replies: 1
    Last Post: 06-27-2008, 11:45 AM
  2. temperature sensors
    By danko in forum C Programming
    Replies: 22
    Last Post: 07-10-2007, 07:26 PM
  3. Loading files with a function call
    By ulillillia in forum C Programming
    Replies: 6
    Last Post: 04-10-2007, 07:19 PM
  4. Replies: 28
    Last Post: 07-16-2006, 11:35 PM
  5. Please Help - Problem with Compilers
    By toonlover in forum C++ Programming
    Replies: 5
    Last Post: 07-23-2005, 10:03 AM