Am i writing the correct pseudocode?
Im confuse in pseudocode for while statement.

Start
        declare variables;
        print “choose account types”;
        read choice;
        if choice = ‘a’ then
	
                  while n<=3
	          print userid and password;
                               read userid1 and password;
	          
	          a = strcmp(u,userid1);
	          b = strcmp(p,password);

                                if a = 0 and b = 0
                                        print Thanks for logging in;
	                    else
                                        print Wrong userid or password;
		                        n++;
                  endwhile
       endif


       if choice = ‘A’ then
                               perform login_form2();
       else
                               print error;
	          perform login_form();
       endif

End

Recommended Answers

All 5 Replies

What are you going to do to the user after 3 tries?

also why don't you use
and operator if(!strcmp(pw,pw)) && if(!strcmp(idid)) { excute following command}; also you should convert a to either upper or lower so you do better only 1 if statement

What are you going to do to the user after 3 tries?

After 3 tries, An error will display...Then the program will end.
Where should i put it?... Above the endwhile?

no after while basically while means repeat code 3 times if he doesnt those 3 times do something then after 3 tries a error should be displayed

Should also exit the while loop if the user enters the correct name and password

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.