pakiniy99
Baby - C
Thank : 0
ออฟไลน์
กระทู้: 3
|
 |
« ตอบ #2 เมื่อ: กันยายน 07, 2011, 11:37:22 am » |
|
ครับต้องทำเป็น pascal แต่ทำได้ละครับ
program com; uses wincrt; var salary:longint; commission,total:real; job:integer;
begin gotoxy (25,1);writeln('=============================='); gotoxy (30,2);writeln('*** Commission ***'); gotoxy (25,3);writeln('=============================='); gotoxy (25,4);writeln('job 1 = Employees Past-Time'); gotoxy (25,5);writeln('job 2 = Employees Full-Time distribute'); gotoxy (31,6);writeln('2 = Manager 3 = Employees 4 = Infront shop'); gotoxy (20,8);write('Enter Salary : '); readln(salary); gotoxy (20,9);write('Enter Job : '); readln(job); if job=1 then begin commission:=salary*15/100; gotoxy (20,10);writeln('Your Commission 15 % = ',commission:1:2); total:=salary+commission; gotoxy (20,11);writeln('Your Total Salary = ',total:1:2); end else if job=2 then begin commission:=salary*10/100; gotoxy (20,10);writeln('Your Commission 10 % = ',commission:1:2); total:=salary+commission; gotoxy (20,11);writeln('Your total Salary = ',total:1:2); end else if job=3 then begin commission:=salary*20/100; gotoxy (20,10);writeln('Your Commission 20 % = ',commission:1:2); total:=salary+commission; gotoxy (20,11);writeln('Your total Salary = ',total:1:2); end else if job=4 then begin commission:=salary*30/100; gotoxy (20,10);writeln('Your Commission 30 % = ',commission:1:2); total:=salary+commission; gotoxy (20,11);writeln('Your total Salary = ',total:1:2); end else begin writeln; gotoxy (20,13);writeln('Error , Only Enter 1,2,3,4 ':34); end; end.
แล้วผมอยากได้คำสั่งที่ถามว่าจะออกจะโปรแกรมไหม ถ้าไม่ก็กลับมาทำใหม่ อะไรประมาณนี้ เหมือนกับสูตรที่คุณ Moshi เคยโพสไว้ในกระทู้ที่ปักหมุด
program it4x; uses crt; var ans:char; begin clrscr; repeat Write('Do you want to Exit (Y/N) = '); readln(ans); ans:=upcase(ans); until ans ='Y'; end.
นี่อะครับ ผมใส่สูตรเข้าไปมันก็ error จึงอยากจะรบกวนอีกนิดนึงอะครับ
|