PDA

View Full Version : Help with C++ assignment


ashooo
11-14-2006, 01:53 PM
Hey,
I'm struggling to get my C++ proect working.

Can anybody point me in the right direction as i cant get my head around the logic with this problem.

I know i have to use nested loops, as ive done others, however it is the spaces that are causing me problems.

You are only allowed to use do...while loops and NO IF statements.
(_ = space, it wont let me add spaces)

1 *
__2 * *
___3 * * *
__4 * * * *
5 * * * * * *

Thanks for your help

bird603568
11-14-2006, 03:49 PM
can use use switch statements? or for loops? or while loops?

pamich
11-14-2006, 05:44 PM
Are you going to five no matter what, or is the end number entered?

ashooo
11-14-2006, 05:58 PM
5 rows no matter what!
Cant use for loops or while loops, however im not sure about switch statements as i've never heard of them, however the brief says using do while loops only.

pamich
11-14-2006, 06:54 PM
Fors are just fancy whiles/do whiles. They can be written to exactly the same thing.

As your assignment shows, you need to increase the spaces printed by one until 3, then decrease them. Should be fairly straight forward.

ashooo
11-14-2006, 07:52 PM
I cant see how to do that without using an if statement

pamich
11-14-2006, 08:44 PM
Ifs are not needed, and I don't really see how one would be useful.