Pcode

**PseudoCode** (soo-doh-code): Essentially pseudocode is the set of step necessary to implement a solution to any given problem. In programming terms it is the program written in English (or whatever language the programmer happens to speak). It is the last step before one starts programming. Here is a sample problem much like the ones you've been working on. Problem: A flower has been placed in a coloured box. Each box carries a statement. Of the three statements, only one is true. Which box contains the flower? **RED ** ||  **YELLOW ** ||  **GREEN ** || **STEP 1: Problem-Definition Table** **Known Facts ** || **User Requirements ** || **Necessary Processing ** || **Alternative Solutions ** || <span style="font-family: Arial,Helvetica,sans-serif;">**STEP 2: Input-Processing-Output Chart** <span style="font-family: Times New Roman,Georgia,Times;">**<span style="font-family: Arial,Helvetica,sans-serif;">Input ** || <span style="font-family: Times New Roman,Georgia,Times;"> <span style="font-family: Times New Roman,Georgia,Times;">**<span style="font-family: Arial,Helvetica,sans-serif;">Data Processing Steps ** || **<span style="font-family: Arial,Helvetica,sans-serif;">Output Data ** || <span style="font-family: Times New Roman,Georgia,Times;"><span style="font-family: Arial,Helvetica,sans-serif;">Each statement inscribed on each box  || <span style="font-family: Arial,Helvetica,sans-serif;">If red box is true, then yellow must also be true. However this is not possible because we would have two true statements and we are given that only one statement at most can be true. If red is false, i.e., the flower is not in the red box, then the statement on the green box is true. If the green box's statement is true, then the yellow box's statement must be false because there can be at most only one true statement. Therefore, the flower is in the yellow box. || <span style="font-family: Arial,Helvetica,sans-serif;">The Yellow Box contains the flower  || <span style="font-family: Arial,Helvetica,sans-serif;">**STEP 3: Pseudo-Code**
 * <span style="font-family: Arial,Helvetica,Geneva,Swiss,SunSans-Regular;">
 * <span style="font-family: Arial,Helvetica,sans-serif;">The flower is in this box. || <span style="font-family: Arial,Helvetica,sans-serif;">The flower is not in this box || <span style="font-family: Arial,Helvetica,sans-serif;">The flower is not in the red box. ||
 * <span style="font-family: Arial,Helvetica,sans-serif;">One box contains the flower. Only 0 or 1 true statement exists || <span style="font-family: Arial,Helvetica,sans-serif;">Find the box that contains the flower || <span style="font-family: Arial,Helvetica,sans-serif;">Start from box 1 assuming it is true, and go through the statements in each box. Follow the true or false consequences of each statement to arrive at the solution || <span style="font-family: Arial,Helvetica,sans-serif;">Start from other boxes and perform similar assumptions and comparisons to find the solution. ||
 * <span style="font-family: Times New Roman,Georgia,Times;">
 * <span style="font-family: Times New Roman,Georgia,Times;">
 * 1) <span style="font-family: Arial,Helvetica,sans-serif;">Read in the three boxes' statements
 * 2) <span style="font-family: Arial,Helvetica,sans-serif;">Assume the red box statement is trueIf (red box's statement is true) then
 * 3) <span style="font-family: Arial,Helvetica,sans-serif;">The yellow boxÕs statement is also true, and we have a contradiction with what we are given, i.e., only one statement at maximum is true, but now we would have two true statements if red box's statement is true, so
 * 4) <span style="font-family: Arial,Helvetica,sans-serif;">If (red box's statement is false) then
 * 5) <span style="font-family: Arial,Helvetica,sans-serif;">The flower is not in the red box, i.e. green box's statement is true
 * 6) <span style="font-family: Arial,Helvetica,sans-serif;">And the yellow must be false because we are given that only one statement at maximum is true, so
 * 7) <span style="font-family: Arial,Helvetica,sans-serif;">If (yellow box's statement is false) then the flower is in the yellow box.