Top and Bottam

Discussion in 'C++' started by vkiransrinivas, Oct 17, 2007.

  1. vkiransrinivas

    vkiransrinivas New Member

    Joined:
    Jun 13, 2007
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    0
    Actually what do you mean by top to bottam and bottam to top.Can i have difference between top to bottam approach and bottam to top approach
     
  2. seeguna

    seeguna New Member

    Joined:
    Jun 20, 2007
    Messages:
    31
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Technical Consultant
    Location:
    Chennai
    Just for an idea i will explain something:

    Topdown Approach
    Execution starts from top of the program to the end...
    Eg: C program
    Code:
    #include<stdio.h>
    void test();
     void main() 
          {
           test();
          }
    void test()
    {
    printf("Test program");
    }
     In this program, Execution starts from top of the main function to the bottom ofthe test function.
    
    Eg: Bottom -to -top approach(C++ program)
    
    #include <iostream>
    using namespace std;
    class sample
    {
    public:
           void test()
               {
              cout<<"Sample";
              }
    };
    
    void main()
            {
            Sample s;
            s.test();
            } 
    In this program,Execution starts from the bottom of the main function to the test function present in a class.
     
    Last edited by a moderator: Oct 17, 2007
  3. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,336
    Likes Received:
    377
    Trophy Points:
    83
    seeguna, have code blocks for code snippets in the posts
     
  4. vkiransrinivas

    vkiransrinivas New Member

    Joined:
    Jun 13, 2007
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    0
    thanks for sending seeguna some explain on theortically with some languages if possible send me
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice