ช่วยเขียนโปรแกรมปาสคาลหน่อยค่ะ :))

ช่วยหนูเขียนโปรแกรมปาสคาลหน่อยค่ะ พร้อมคำอธิบายของโปรแกรมอ่ะ ขอให้รันผ่านด้วยนะค่ะ

:)
ต้องส่งแล้วแต่ทำไม่ได้เลย จน ปัญญาช่วยหนูด้วยนะค่ะ

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

#1
Moshi
Moshi
16,996 โพสต์
โปรแกรมอะไรคับ??
#2
nooknickz
nooknickz
86 โพสต์
เกี่ยวกับอะไรก็ได้ค่ะ ประมาณ 50 บรรทัดอ่ะค่ะ  :)
#3
Moshi
Moshi
16,996 โพสต์
เอาง่ายๆเลยนะคับ อิอิ 50 บรรทัด

program line50;
uses crt;
begin
      writeln('1');
      writeln('2');
      writeln('3');
      writeln('4');
      writeln('5');
      writeln('6');
      writeln('7');
      writeln('8');
      writeln('9');
      writeln('10');
      writeln('11');
      writeln('12');
      writeln('13');
      writeln('14');
      writeln('15');
      writeln('16');
      writeln('17');
      writeln('18');
      writeln('19');
      writeln('20');
      writeln('21');
      writeln('22');
      writeln('23');
      writeln('24');
      writeln('25')
      writeln('26');
      writeln('27');
      writeln('28');
      writeln('29');
      writeln('30');
      writeln('31');
      writeln('32');
      writeln('33');
      writeln('34');
      writeln('35');
      writeln('36');
      writeln('37');
      writeln('38');
      writeln('39');
      writeln('40');
      writeln('41');
      writeln('42');
      writeln('43');
      writeln('44');
      writeln('45');
      writeln('46');
      writeln('47');
      writeln('48');
      writeln('49');
      writeln('50');
      readln;
end.
#4
nooknickz
nooknickz
86 โพสต์
ง่ายปัยมั๊ยพี่โมชิ อ่ะ  :(
#5
kag
kag
5 โพสต์
Program WisarutATM; 
Uses Wincrt; 
Var  pw,mycode,mycode2,mycredit,cusdrw:Integer; 
     myname:String; 
Const mypw=1234; 

   Procedure  EnterPWD(var pw:integer); 
     begin 
        clrscr; 
        Write('Enter password : '); Readln(pw); 
        If pw=mypw Then 
           begin 
               clrscr; 
               writeln('**Correct password**':20); 
               write('Press Enter to continue...'); readln; 
           end 
           Else 
              begin 
                 clrscr; 
                 writeln('Incorrect password!'); 
                 write('Try again[2] : '); readln(pw); 
                 if pw=mypw then 
                 begin 
                  clrscr; 
                  writeln('**Correct password**':20); 
                  write('Press Enter to continue...'); readln; 
                 end 
                 else 
                   begin 
                    clrscr; 
                    writeln('Incorrect password!');; 
                    write('Try again[3] : '); readln(pw); 
                    if pw=mypw then 
                    begin 
                      clrscr; 
                      writeln('**Correct password**':20); 
                      write('Press Enter to continue...'); readln; 
                    end 
                    else 
                      begin 
                        clrscr; 
                        writeln('Incorrect password!'); 
                        writeln('Please contact the bank.'); 
                      end; 
                   end; 
              end; 
        end; 

   Procedure MenuChkCredit; 
      begin 
        clrscr; 
        write('Account Name : '); readln(myname); 
        write('Balance : '); readln(mycredit); 
      end; 

   Procedure Mainmenu(var mychk:integer); 
      begin 
        clrscr; 
        writeln('**{[[[ MAINMENU ]]]}**':42); 
        gotoxy(3,3); write('[1] <<-Select 1 for Deposit'); 
        gotoxy(38,3); write('Select 2 for Withdrawal ->> [2]'); 
        gotoxy(3,5); write('[3] <<-Select 3 for Cancel'); 
        gotoxy(32,7); write(']'); 
        gotoxy(30,7); write('['); readln(mychk); 
      end; 
   Procedure Menu1; 
      var sal:integer; 
      begin 
         clrscr; 
         writeln('**{[[[ Deposit ]]]}**':20); 
         write('Insert *** = '); readln(sal); 
         if sal < 0 then 
           begin 
           writeln('Cannot deposit (-)number!'); 
           write('Press Enter to continue...'); 
           readln; 
           end 
           else 
             begin 
               mycredit:=mycredit+sal; 
               writeln('Current balance = ',mycredit); 
               write('Press Enter to Mainmenu...'); readln; 
             end; 
      end; 

    Procedure MenuWithdraw(var mychk2:integer); 
      begin 
        clrscr; 
        writeln('**{[[ Withdrawal ]]}**':42); 
        gotoxy(3,3); write('[1] <<- Withdraw 500 Baht'); 
        gotoxy(35,3); write('[2] <<- Withdraw 1000 Baht'); 
        gotoxy(3,5); write('[3] <<- Withdraw 5,000 Baht'); 
        gotoxy(35,5); write('[4] <<- Withdraw 10,000 Baht'); 
        gotoxy(3,7); write('[5] <<- Withdraw 20,000 Baht'); 
        gotoxy(35,7); write('[6] <<- Customize Withdraw'); 
        gotoxy(3,9); write('Select and Press Enter ->>'); 
        gotoxy(37,9); write(']'); gotoxy(35,9); write('['); readln(mychk2); 
      end; 

    Procedure ShowDraw(drw:integer); 
      begin 
        clrscr; 
        writeln('** Withdrawal Information **'); 
        gotoxy(3,3); writeln('Withdraw = ',drw); 
        gotoxy(3,5); writeln('Curren Balance = ',mycredit); 
        gotoxy(1,7); write('Press enter to continue...'); 
        readln; 
      end; 

    Procedure OverCredit(ovr:integer); 
      begin 
       clrscr; 
       writeln('Cannot withdraw ',ovr); 
       writeln('Because Balance = ',mycredit); 
       write('Press Enter to Mainmenu...'); 
       readln; 
      end; 
    Procedure CusDraw(var cusdrw:integer); 
      begin 
        clrscr; 
        writeln('** Customize Withdraw **'); 
        gotoxy(3,3); write('Insert *** = '); readln(cusdrw); 
      end; 

Begin 
    EnterPWD(pw); 
    If pw<>mypw Then 
       readln 
    else 
    MenuChkCredit; 
    While pw=mypw do 
    begin 
    Mainmenu(mycode); 
    If mycode=1 Then 
       Menu1 
       Else If mycode=2 Then 
         begin 
           MenuWithdraw(mycode2); 
           If mycode2=1 Then 
              begin 
                if 500 > mycredit then 
                 OverCredit(500) 
                else 
                 begin 
                  mycredit:=mycredit-500; 
                  ShowDraw(500); 
                 end; 
                end 
              else if mycode2=2 then 
                begin 
                  if 1000 > mycredit then 
                   OverCredit(1000) 
                   else 
                     begin 
                      mycredit:=mycredit-1000; 
                      ShowDraw(1000); 
                     end; 
                end 
                else if mycode2=3 then 
                  begin 
                    if 5000 > mycredit then 
                      OverCredit(5000) 
                      else 
                        begin 
                          mycredit:=mycredit-5000; 
                          ShowDraw(5000); 
                        end; 
                    end 
                  else if mycode2=4 then 
                    begin 
                      if 10000 > mycredit then 
                        OverCredit(10000) 
                      else 
                        begin 
                          mycredit:=mycredit-10000; 
                          ShowDraw(10000); 
                        end; 
                    end 
                    else if mycode2=5 then 
                      begin 
                        if 20000 > mycredit then 
                          OverCredit(20000) 
                        else 
                          begin 
                            mycredit:=mycredit-20000; 
                            ShowDraw(20000); 
                          end; 
                       end 
                      else if mycode2=6 then 
                       begin 
                         CusDraw(cusdrw); 
                         if cusdrw <0 then 
                           begin 
                           writeln('Cannot withdraw (-)number'); 
                           write('Press enter to continue...'); readln; 
                           end 
                           else 
                             begin 
                               if cusdrw > mycredit then 
                               OverCredit(cusdrw) 
                               else 
                               begin 
                                mycredit:=mycredit-cusdrw; 
                                ShowDraw(cusdrw); 
                               end; 
                             end; 
                       end 
                       else 
                         begin 
                           writeln('No selected menu!'); 
                           write('Press enter to continue...'); readln; 
                         end; 

         end 
         Else If mycode=3 Then 
            EnterPWD(pw) 
            Else 
             begin 
              Writeln('No selected menu!'); 
              Write('Press Enter to Mainmenu...'); Readln; 
             end; 
       end; 

End. 



****************************************************************** 

จบคับ.....................

มาจากที่นี่ครับ <http://www.sudipan.net/phpBB2/viewtopic.php?p=32711>
ส่วนคำอธิบาย ต้องรบกวนแอทมินแล้วละคับ ใช้ได้ไม่ได้ก้ออย่าว่ากันนะคคับ มือไหม่เหมือนัน ;D :P
#6
nooknickz
nooknickz
86 โพสต์
555

ในห้องมีคนทำแล้ว