Completely Stumped..please help

Hello all, I am a new C++ student and am having some difficulty understanding some of the language. If I could receive some sort of help on the following problem I would greatly appreciate it.

What does the following nested loop output ?

count = 1;
while (count <= 11)
{
innerCount = 1
while innerCount <= (12 - count) / 2)
{
cout << " ";
innerCount++;
}
innerCount = 1;
while (innerCount <= count)
{
cout << "@";
innerCount++;
}
cout << endl;
count++;
}

Thank you guys so much !

Run it and find out.
I think the goal of this is to find the errors in the program. Which there are several.

The first thing you need to do is to learn to format the code with tabs or spaces.

1
2
3
4
5
6
7
8
#include <iostream>
using namespace std;
int main()
{
// Insert code here

return 0;
}



Hint, there are 4 errors, see if you can find them.
Last edited on
Abstraction, if you dont know, just say you dont know instead of a response of that sort. If I was on a machine that was capible of compiling then I certainly would. I am on my work machine therefore I can't.
We don't do homework for people here. We love to help you arrive to the answer yourself, but we won't give it to you. Homework is so you can learn, if we give you the answer, what have you learned?

Now I recommend editing your original post and re-pasting this code in using code tags. The are located the right or below the box you type in, denoted with an icon of <>
Gotcha. Thank you for your help !
If you were having trouble with compile errors you should have said so and posted the errors. If you are having trouble understanding specific statements, then you should have made clear which statements are giving you trouble.

As ResidentBiscuit said, we're here to help but we don't do homework assignments.

Problems with your code:
1) You're missing #include <iostream> and using namespace std;
2) count and innerCount are not defined.
3) Code needs to be enclosed in a proper function (main)
4) You're missing closure for one of your while loops.
5) You're missing a semicolon at line 4.
6) You haven't edited your post to use code tags as requested.
Last edited on
Thank you Abstraction. Have a good day! You were zero help, as I suspected.
We won't help you if you won't even bother to put forth the minimal effort to help yourself.
coj2b wrote:
What does the following nested loop output ?
We won't tell you the answer, we will only tell you how to come to the answer. So far you have not answered this question:
AbstractionAnon wrote:
If you are having trouble understanding specific statements, then you should have made clear which statements are giving you trouble.


coj2b wrote:
You were zero help, as I suspected.
He was plenty help. You were zero tolerant, as we suspected.
Last edited on
@coj2b,

That's not really a way to get help. I'll be sure to not answer your threads.
Topic archived. No new replies allowed.