- text ("Click mouse left to go to next page", 150, height-45);
+text ("Click mouse left to go to next page", 150, height-45);
-//////////////////////////////////////////////////////////////con///////////////////////////////////////////////////////////////////
+void practice (int y7) {
+background (153, 0, 153);
+quad ((width/2), -250, width+250, (height/2), (width/2), height+250, -250, (height/2));
+text ("Practice", (width/2)-90, 70);
+text ("Write a program to show Addditions results", (width/2)-300, y7);
+text ("of a number between 1-100.", (width/2)-300, y7+30);
+text ("SLOVE:", 80, y7+80);
+text ("Step 1 : Declare a variable according to the directive", 120, y7+130);
+text ("by x1 = 1;", 100, y7+160);
+text ("x2 = 100;", 100, y7+190);
+text ("result is a result of Additions", 100, y7+220);
+text ("In general, we can calculate the sums ranging from 1-100 of this theroem.", 100, y7+250);
+text ("(the first number + the last number) * (the last number / 2).", 100, y7+280);
+text ("void setup (){", 100, y7+310);
+text ("int x1 = 1;", 100, y7+340);
+text ("int x2 = 100;", 100, y7+370);
+text ("int result;", 100, y7+400);
+text ("result = (x1+x2)+(x2/2);", 100, y7+430);
+text ("print (''result=''+result);", 100, y7+460);
+text ("}", 100, y7+490);
- text("If-else", 430, 80);
- line(430, 85, 495, 85);
- text("If : Allows the program to make a decision about which code to execute.", xCon1+50, 120);
- text("If the test evaluates to true, the statements enclosed within the block are executed", xCon1, 160);
- text("and if the test evaluates to false the statements are not executed.", xCon1, 200);
- ///////////////////////////////////////////////////////////////////////////////////////////////////
- text("else : Extends the if structure allowing the program to choose between", xCon2, 240);
- text(" two or more block of code. It specifies a block of code to execute", xCon2-50, 280);
- text("when the expression in if is false.", xCon2-50, 320);
- ////////////////////////////////////////////////////////////////////////////////////////////////////
- // // ButtonChangePage(820, 550, "Press Key 1");
- text("* example *", xCon3+100, 360);
- text("int x=30;", xCon3+300, 400);
- text("if( x < 20 ){", xCon3+300, 440);
- text("println(100);", xCon3+330, 480);
- text("}else{", xCon3+300, 520);
- text("println(200);", xCon3+330, 560);
- text("}", xCon3+330, 600);
- text("}", xCon3+300, 640);
- line(430, 85, 480, 85);
- text("For Loop : A basic for structure has three parts: init, test, and update.", 150, yCon1);
- text("Each part must be separated by a semicolon (;). The loop continues until the test evaluates to false,", 100, yCon1+40);
- text("When a for structure is executed.", 100, yCon1+80);
- text("* example *", 200, yCon1+120);
- text("for (int i = 0; i < 80; i = i+5) {", 340, yCon1+120);
- text("line(30, i, 80, i);", 380, yCon1+160);
- text("}", 340, yCon1+200);
- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- // // ButtonChangePage(820, 550, "Press Key 2");
- text("While Loop : executes a series of statements continuously while the expression is true.", 150, yCon2);
- text("The expression must be updated during the repetitions or the program will never break out of while.", 100, yCon2+40);
- text("* example *", 200, yCon2+80);
- text("int i = 0;", 340, yCon2+80);
- text("while (i < 80) {", 340, yCon2+120);
- text("line(30, i, 80, i);", 380, yCon2+160);
- text("i = i + 5;", 380, yCon2+200);
- text("}", 340, yCon2+240);
- PImage Img1 = loadImage("http://www.zentut.com/wp-content/uploads/2007/12/c-if-else-statement.png", "png");
- PImage Img2 = loadImage("http://www.functionx.com/cpp/images/flowchart11.gif", "gif");
- text("Flowchart", 400, 80);
- line(400, 85, 490, 85);
- text("If-else", 210, 160);
- text("Loop", 610, 160);
- // ButtonChangePage(820, 600, "Press Key 3");
- text("Explanation of ' Loop ' working methods", 260, 80);
- rect(310, 150, 280, 60);
- ellipse(x_roll+g_roll, y_fall, 50, 50);
- if (keyCode==DOWN&&(x_roll>350)&&(x_roll<550)) {
- text("Out of Loop!", 300, 450);
- text("False", 230, 180);
- text("True", 230, 180);
- text("Suppose the White box is a loop condition", 250, 280);
- text("and pink ball is work in a true statements", 255, 320);
- text("Press 'Down key' to make 'false' statements", 250, 400);
- line(450, 430, 450, 510);
- line(440, 500, 450, 520);
- line(450, 520, 460, 500);
- text("Explanation of ' if-else ' working methods", 250, 80);
- // line(250, 130, 250, height-20); //if
- // line(350, 130, 350, height-20);
- // line(550, 130, 550, height-20); //else
- // line(650, 130, 650, height-20);
- quad(350, 170, 450, 120, 550, 170, 450, 240); //condition
- line(170, 170, 400, 170); //left
- line(170, 170, 170, 250);
- line(160, 240, 170, 250);
- line(180, 240, 170, 250);
- line(170, 300, 170, 530);
- rect(50, 260, 210, 100);
- line (500, 170, 730, 170); //right
- line(730, 170, 730, 360);
- line(720, 350, 730, 360);
- line(740, 350, 730, 360);
- line(740, 380, 740, 530);
- rect(630, 370, 210, 100);
- line(170, 530, 740, 530);
- line(450, 530, 450, 600);
- ellipse(450, 620, 100, 50);
- ellipse(x_pos_ball, y_pos_ball, 50, 50);
- text("The true statements", 60, 330);
- text("else", 710, 410);
- text("The false statements", 640, 450);
- text("CONDITION", 395, 175);
- text("When it false", 390, 380);
- line(390, 420, 480, 420);
- line(480, 410, 500, 420);
- line(500, 420, 480, 430);
- else if (y_pos_ball>350&&y_pos_ball<850) {
ไม่มีความคิดเห็น:
แสดงความคิดเห็น