3
votes
Pset3 - Multiple nested if statements
Not sure what you mean by "many" if statements, but most people will use two nested for loops to create the bricks - an inner for loop to create each row and an outer for loop to do multiple rows. ...
3
votes
So Close on Mario Pyramid
the pseudocode for Mario
for height of pyramid
for (calculate nr. of spaces at height)
print ' '
for (calculate nr. of hashes at height)
print '#'
print a newline
I'd defer ...
2
votes
How to break out of nested for loops
I am not sure what your problem is, but you can call break at any time, here is an example:
do
{
// For loop 1
for (int i = 0; i < n; i++)
{
// For loop 2
for(int k = 0;...
1
vote
Accepted
what is the significance of break; in tabulate function?
Each round counts one vote per voter, for their top preferred, non-eliminated candidate. Once that vote is counted, program moves on to the next voter. From the C99 standard section 6.8.6.3:
A ...
1
vote
Accepted
How to initiate bricks in pset3 breakout game?
Look at the value of X after you create your first row of bricks. Using your image, that's 9 bricks in the first row. The 10th brick is going to be at x=405, outside the window. How are you going to ...
1
vote
Accepted
Mario counter and output problem
First of all, notice that inside a for loop you can use other variables as well, not only counter. E.g.:
for(counter = 1; counter <= height; counter++)
{
int row_number = counter;
int ...
Only top scored, non community-wiki answers of a minimum length are eligible