Search code examples
pseudocode

How can I write pseudocode for the following diagram?


I failed to use the do-while or while loop for the following diagram:

enter image description here

Here, A, B, and C are functions. How can I write pseudocode for the diagram above?

EDIT: This is from my programming practice of C++. Without the "B loop" (or the "A loop"), I am able to write it as the following:

Start
Input x;
while(x!=2)
{
A(); Input x;
}
C();
End

However, when the "B loop" comes in, I have no idea how to include it.


Solution

  • Start;
    
    Input x;
    
    while(x!=2){ 
    
        if (x!=1){
            A();
        } else{ 
            B()
        }
        Input x;
    }
    
    C();
    
    End
    

    But beware of the langage you are using I advise you to add a sleep mode between data aquisitions (Just before Input x)