![]() |
|
#1
|
|||
|
|||
Reversing Output, Pascals trianglei have the following C++ code:
CPP / C++ / C Code:
the output is: (if the input is "4") 1 3 3 1 1 2 1 1 1 1 I want the output to be: 1 1 1 1 2 1 1 3 3 1..... I used microsoft visual c++ There are no errors. Can you help me please? Thanks. |
|||
|
#2
|
||||
|
||||
Re: Reversing Output, Pascals triangleHi worms,
Welcome to the GID Forums. First, your loop should be changed. It is doing unnecessary things. For example, CPP / C++ / C Code:
Is equivalent to this: CPP / C++ / C Code:
Do you know why? Next, why does it print from the back? Because you loop the 'rows' in descending order. i.e Instead of looping from rows to 0, loop from 0 to rows. Then it will print correctly. Regards, Paramesh. __________________
Don't walk in front of me, I may not follow. Don't walk behind me, I may not lead. Just walk beside me and be my friend. |
Recent GIDBlog
Problems with the Navy (Officers) by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Apache / PHP problem, maybe output length? | HaganeNoKokoro | Apache Web Server Forum | 3 | 07-Aug-2008 04:42 |
| editbox output problem | FireFox8173 | MS Visual C++ / MFC Forum | 1 | 01-Apr-2005 14:15 |
| using vector or array | oshiotse | C++ Forum | 4 | 16-Apr-2004 10:59 |
| urgent: problem + output filters | jack | Apache Web Server Forum | 0 | 04-Feb-2004 22:32 |
| articles -> output | Allowee | Learning Journal by J de Silva | 1 | 05-Jun-2003 19:47 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The