Procedures

This is a discussion on Procedures within the C++ Programming forums, part of the General Programming Boards category; I have been learning to program at school using the pascal language in programming... I was just wondering if there ...

  1. #1
    Registered User
    Join Date
    Feb 2002
    Posts
    5

    Procedures

    I have been learning to program at school using the pascal language in programming... I was just wondering if there was an equivilent to the procedures script used in Pascal for C++. thanks

    (Demonstrate if possible!)

  2. #2
    Unregistered
    Guest
    I don't know Pascal. What does script do?

  3. #3
    Registered User
    Join Date
    Feb 2002
    Posts
    8
    i don't know if this is what you mean, and i've forgotten almost all of pascal, but:

    pascal:

    Code:
    procedure Name1   // creates procedure 1
    begin
       <<code>>           // procedure 1 code
    end;
    
    procedure Name2  // creates procedure 2
    begin
       <<code>>          // procedure 2 code
    end;
    
    procedure Name1;   // executes procedure 1
    procedure Name2;   // executes procedure 2
    end.
    would be the same as:

    C++:

    Code:
    void Function1();    // 'creates' function 1
    void Function2();    // 'creates' function 2
    
    int main(void)
    {
       Function1();        // executes function 1
       Function2();        // executes function 2
    }
    
    void Function1()    
    {
       <<code>>          // function 1 code
    }
    
    void Function2()
    {
       <<code>>          // function 2 code
    }

  4. #4
    Unregistered
    Guest

    Unhappy

    I believe ChrisE is correct

    except his main should return 0;


    int main()
    {

    function1();
    function2();

    return 0;
    }

    was just wondering if there was an equivilent to the procedures script used in Pascal for C++. thanks

    What are scripts?? Be careful with what you say. I would call it a procedure syntax or declarations- not scripts.

    That is a web person!!!

  5. #5
    Registered User
    Join Date
    Feb 2002
    Posts
    8
    woops, sorry, was in a rush etc

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need Help With Sub Procedures
    By jbyers19 in forum C Programming
    Replies: 3
    Last Post: 04-08-2006, 11:04 AM
  2. how to use same variable in different procedures?
    By Brigs76 in forum C++ Programming
    Replies: 3
    Last Post: 04-24-2005, 05:37 PM
  3. Linking Fortran procedures with C program
    By gest in forum C Programming
    Replies: 5
    Last Post: 07-14-2003, 12:35 PM
  4. classes and window procedures
    By bennyandthejets in forum Windows Programming
    Replies: 4
    Last Post: 12-25-2002, 06:02 PM
  5. Class Procedures
    By Marky_Mark in forum C++ Programming
    Replies: 4
    Last Post: 10-27-2001, 05:03 AM

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