Issues with the do-while looping

So I've found a new problem with my program.

what i want to know is, is there a way to do a 'do-while' loop with two whiles referring to the same do, for example.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
if (CHP == 0)
{
do{
cout<< Some strings and stuff etc;
cin >> Q00;
}while (Q00 == c)

cout<< Some more strings and stuff etc
cin >> Q0;
}while(Q0 == c)


}

else if
{
}


I was having troubles getting this concept to work, Im not sure if im having syntax errors, or if this concept just wont work.

Any help would be appreciated
Thanks
Last edited on
You can't have a while the way you have put it. It must have a do before it.
so
should it look something like:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
if (CHP == 0)
{

do{
do{
cout<< Some strings and stuff etc;

cin >> Q00;

}while (Q00 == c)

cout<< Some more strings and stuff etc

cin >> Q0;

}while(Q0 == c)


}

else if
{
}


See the thing is, I Want both the do-while loops to start the loop at the same point, would the way I have it up there work?
So long as there isn't anything in the way of the two do's (You don't have anyting in the way), they pretty much start at the same time.

(Compile it and see if it works.)
Last edited on
So, I found out what the issue is ^_^, no its just a matter of solving it lol.

so as for the loop with in a loop the issue is I'm doing this:

1
2
3
4
5
6
7
8
9
do {
if ( Q == 01)
{ 
cout<< strings and stuff etc;
cin  >> Q0;
}while (Q0 == 'c');

}


from playing with the code I found out that , that just simply wont work unless I have it like:

1
2
3
4
5
6
7
8
9

if ( Q == 01)
{ 
do{
cout<< strings and stuff etc;
cin  >> Q0;
}while (Q0 == 'c');

}


for whatever reason I have to have the do while within the same function, or it wont work, the issue is, how do i get it to work without it being in the same function?
Topic archived. No new replies allowed.