Closed Thread
Results 1 to 3 of 3

Thread: c++ to pascal(simple code)

  1. #1
    lukasyno is offline Newbie
    Join Date
    Nov 2009
    Posts
    2
    Rep Power
    0

    c++ to pascal(simple code)

    Hello
    I have request, anyone can port this code (c++) to pascal language, because for me pascal is a bit strange I dont understand fundamental syntax etc ..

    Code:
    void drawTree()
    {   
        int numTrees;
        
        cout<<"how many?\n";
        cin>>numTrees;
    
        int rows = 3;
        int trees = numTrees-1;
        
        for(int g=0 ; g < numTrees; g++)
        {
            for(int i=0 ; i < rows ; i++)
            {
               for(int a = (rows-i)+trees ; a>1 ; a--)cout<<" ";
               for(int b = 0 ; b<3+(i*2) ; b++) cout<<"o";        
               cout<<"\n";
            }
           ++rows;
            --trees;
        }   
        cout<<"\ngoodbye";cout<<"\n ";
    }
    thanks in Advance!

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Join Date
    Jul 2006
    Posts
    16,491
    Blog Entries
    75
    Rep Power
    143

    Re: c++ to pascal(simple code)

    You'll use print() instead of cout<<, the for loop syntax is pretty similar. What part is confusing? Oh, and you'll use the procedure keyword instead of void.
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  4. #3
    lukasyno is offline Newbie
    Join Date
    Nov 2009
    Posts
    2
    Rep Power
    0

    Re: c++ to pascal(simple code)

    ok Done I am cool

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. need help on pascal code.
    By xerox601 in forum General Programming
    Replies: 3
    Last Post: 07-17-2011, 02:20 PM
  2. Code: Pascal Snake Game
    By TcM in forum Pascal and Delphi Tutorials
    Replies: 86
    Last Post: 09-11-2009, 07:24 AM
  3. Very simple problem! Pascal Help
    By 2710 in forum Pascal and Delphi
    Replies: 2
    Last Post: 02-10-2009, 10:43 AM
  4. 2 simple pascal problem help!pls
    By rlpp in forum Pascal and Delphi
    Replies: 3
    Last Post: 12-26-2008, 07:01 AM
  5. code:pascal phonebook
    By mohsen_j in forum General Programming
    Replies: 3
    Last Post: 01-22-2007, 11:41 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts