ท่าน แอดมินดูให้ทีครับ กรุณาด้วยครับ

รอบกวน ท่านแอดมีนอีกซักทีครับ(งานครั้งนี้มีผลต่อผมเป็นอย่างมากครับ ผมทำไม่ได้จริงๆครับโง่มากมาย)

              กรุณาด้วยครับ(ต้องส่งวันจันทร์ ผมก็งมทำอยู่เหมือนกันแต่กลัวทำไม่ได้และไม่ทันครับ งานนี้จำเป็นอย่างมากครับ)



Program sem6_13;
Uses crt;
Var  height,base,redius,width,length,side,area:real;
    ans:char;

Begin
    clrscr;
    writeln('Menu selection for calculate the area');
    writeln;
    writeln('1.Triangle.');
    writeln('2.Circle.');
    writeln('3.Rectangln.');
    writeln('4.Square.');
    write('Select =====>'); ans:=readkey;
    writeln;
    case ans of
         '1':begin
                  write('base ='); readln(base);
                  write('height ='); readln(height);
                  area:=0.5*base*height;
                  writeln('Area of triangle =',area:6:2);
             end;


          '2':begin
                   write('radius ='); readln(redius);
                   area:=pi*redius*redius;
                   writeln('Area of circle +',area:6:2);
              end;


          '3':begin
                   write('width ='); readln(width);
                   write('length ='); readln(length);
                   area:=length*width;
                   writeln('Area of rectangle =',area:6:2);
              end;


          '4':begin
                   write('side of square ='); readln(side);
              area:=side*side;
              writeln('Area of square =',area:6:2);
              end;
           end;{Case}
           writeln(#07);
           readln;
End.


จากโปรแกรมนี้ จงปรับปรุงแก้ไขโปรแกรม ในส่วนของ ให้เพิ่มการถามผู้ใช้ว่าต้องการคำนวนหาพื้นที่ต่อหรือไม่(DO YOU WANT  TO CALCULATE AGIN (Y/N))  ดังนี้ ถ้าผู้ใช้งานต้องการคำนวนหาพื้นที่ต่อไปให้กด Y ถ้าผู้ใช้ไม่ต้องการให้กด N ถ้าผู้ใช้งาน กดอักษรตัวอื่น ๆ ที่ไม่ใช่ y  หรือ n ให้มีข้อความถามว่า DO YOU WANT  TO CALCULATE AGIN (Y/N) ซ้ำอยู่ย่างนั้น จนกว่าผู้ใช้จะกด Y หรือ N โดยให้ใช้คำสั้ง  GOTO,WHILE,REPEAT (1โปรแกรมต่อ 1คำสั้ง)
                                                                                     ขอบคุณเป็นอย่างสูงครับ
🏷️ หัวข้อที่เกี่ยวข้อง

💬 การตอบกลับ 3

#1
freedom008
freedom008
11 โพสต์
ผมลองทำ  repeat แล้ว แต่มันยังไม่เป็ยอย่างที่โจทร์บอกอ่ะครับ

Program sem6_13;
Uses crt;
Var  height,base,redius,width,length,side,area:real;
    ans:char;

Begin
    Repeat
    clrscr;
    writeln('Menu selection for calculate the area');
    writeln;
    writeln('1.Triangle.');
    writeln('2.Circle.');
    writeln('3.Rectangln.');
    writeln('4.Square.');
    write('Select =====>'); ans:=readkey;
    writeln;
    case ans of
          '1':begin
                  write('base ='); readln(base);
                  write('height ='); readln(height);
                  area:=0.5*base*height;
                  writeln('Area of triangle =',area:6:2);
              end;


          '2':begin
                    write('radius ='); readln(redius);
                    area:=pi*redius*redius;
                    writeln('Area of circle +',area:6:2);
              end;


          '3':begin
                    write('width ='); readln(width);
                    write('length ='); readln(length);
                    area:=length*width;
                    writeln('Area of rectangle =',area:6:2);
              end;


          '4':begin
                    write('side of square ='); readln(side);
              area:=side*side;
              writeln('Area of square =',area:6:2);
              end;
            end;{Case}
            write('Do you want to calculate again(y/n)');
            Repeat
                            readln(ans); {and:=readkey;}
            Until (ans='Y')  or (ans='y')    or (ans='N')  or  (ans='n');

            Until  upcase(ans)='N';  {until (ans='N') or (ans='n');}

            writeln(#07);
            readln;
End.
#2
freedom008
freedom008
11 โพสต์
ท่านผู้รู้โปรดช่วยผมทีครับ :-*
#3
Moshi
Moshi
16,996 โพสต์
ต้องขออภัยที่ผม ยังไม่ตอบให้นะครับ

พอดีพึ่งออกจาโรงบาล

เดียวไว้หายดีจะมาคิดให้คับ