Activity Diagram Problem

Indicate the C ++ code to the following activity diagram (a-h are statements or conditions; note: first code in advance on the lube / reverse side, then correct if necessary, then "clean" here below):

I have a little problem with the right side of the activity diagram to implement :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

while(1){
while(a){
b;
if(c==true){
e;
continue;
}
else(){
d;
break;
}
}
while(f){
h;
}
}



What should I do with the g on the right side ?

I have problems to implement it ?

Here is the Activity Diagramm:
https://www.pic-upload.de/view-35359746/Bildschirmfoto2018-05-21um20.01.39.png.html
Looks like:

1
2
3
4
5
while (!f)
{
  g;
}
h;
Thanks .
The other code parts are right?
Don't think so.

You're supposed to branch based on a.
What do you mean ?

I think he means that you aren't setting any conditions for a, other than if it is true. Instead consider:
1
2
3
4
5
6
7
8
 
while(true) {
   if(a) {
     // branch from here
   else {
     // branch from here
   }
}


Now you are branching based on a. Think of branching as a tree. Does this answer your question?
Last edited on
In this example they dont branch ?
That s why I didnt ?
https://www.pic-upload.de/view-35361923/Bildschirmfoto2018-05-22um09.45.35.png.html
In this example, https://www.pic-upload.de/view-35361923/Bildschirmfoto2018-05-22um09.45.35.png.html , there is no branch, but in the example you're doing, https://www.pic-upload.de/view-35359746/Bildschirmfoto2018-05-21um20.01.39.png.html , there is a branch.

You're doing the one with the branch.
while(1){
if(a){
b;
}
if(c==true){
e;
continue;
}
else(){
d;
break;
}

while(!f){
g;
}
h
}

Is the code now right?
Topic archived. No new replies allowed.