ข่าว IT ล่าสุด
ถูกใจอย่าลืม Like Fanpage
ช่วยทีนะครับ
แสดงแล้ว 5123 ครั้ง /
กันยายน 07, 2011, 11:46:15
สมาชิกไม่มีภาพ

pakiniy99

ออฟไลน์
กระทู้ : 3
คะแนนขอบคุณ : 0
โจทย์บอกว่า : เขียนโปรแกรมในการคำนวณค่าล้างอัดรูปกับร้าน PhotoShop โดยมีการให้บริการ 2 บริการ คือ ล้าง-อัดรูป และ ถ่ายรูป
           ราคาค่าถ่ายรูปคิดดังนี้
ถ่าย 6 ใบ ราคา 90 บาท
ถ่าย 12 ใบ ราคา 120 บาท
ส่วนราคาในการล้าง-อัดรูป คิดตามราคาท้องตลาดทั่วไป(ตรงส่วนนี้ผมสมมุติว่า 1 ใบ 50 บาท)

program photo;
uses wincrt;
var  choice:integer;
     price:longint;
     amount,total:real;

begin
     gotoxy (25,1);writeln('==============================');
     gotoxy (30,2);writeln('*** PhotoShop ***');
     gotoxy (25,3);writeln('==============================');
     gotoxy (25,4);writeln('Choice 1 = 6 Photo 90 Bath');
     gotoxy (25,5);writeln('Choice 2 = 12 Photo 120 Bath');
     gotoxy (31,6);writeln('Choice 3 = 1 Photo : 50 Bath');
     gotoxy (20,8);write('Enter Choice            : ');
     readln(Choice);
if choice=1 then
   begin
        gotoxy (20,10);write('Price 6 Photo 90 Bath');
   end
else if choice=2 then
   begin
        gotoxy (20,11);write('Price 12 Photo 120 Bath');
   end
else if choice=3 then
   begin
        write('Enter amount :');
        readln(amount);
        price:=amount*50;
        writeln('amount =',price:1:2);
        total:=amount+price;
        writeln('u price =',total:1:2);
   end

else
        begin
        writeln;
        gotoxy (20,14);writeln('Error , Only Enter 1,2,3, ':34);
        end;
   end.

-------------------------------------------------
-------------------------------------------------
ตรงส่วนที่ทำตัวหนานั่นคือ ตรงที่มัน error ไม่รู้ว่าผิดยังไงแล้วจะแก้ไขยังไง  
แล้วก็ตรงตัวแปรนั้นจะต้องเขียนยังไงใส่ยังไงด้วย
จึงอยากจะรบกวนให้ช่วยหน่อยนะครับ
(ตรงส่วนที่ผิดนั้น ผมต้องการจะ..
- หากเลือก Choice 3
- แล้วก็จะขึ้นบรรทัดใหม่ ให้ใส่ จำนวนรูป
- แล้วเอาจำนวนรูปนั้นมา *50 (คูณ50)
- แล้วแสดงผลลัพธ์ออกมา)

รบกวนด้วยนะครับ

« แก้ไขครั้งสุดท้าย: กันยายน 07, 2011, 12:04:12 โดย pakiniy99 »

สมาชิกไม่มีภาพ

dekpascal

ออฟไลน์
กระทู้ : 5
คะแนนขอบคุณ : 0
ตุลาคม 02, 2011, 14:13:36
program photo;
uses crt;
var  choice : integer;
     price,amount,total : longint;

begin
     clrscr;
     gotoxy (25,1);writeln('==============================');
     gotoxy (30,2);writeln('*** PhotoShop ***');
     gotoxy (25,3);writeln('==============================');
     gotoxy (25,4);writeln('Choice 1 = 6 Photo 90 Bath');
     gotoxy (25,5);writeln('Choice 2 = 12 Photo 120 Bath');
     gotoxy (25,6);writeln('Choice 3 = 1 Photo : 50 Bath');
     gotoxy (20,8);write('Enter Choice            : ');
     readln(Choice);
if choice = 1 then
   begin
        gotoxy (20,10);write('Price 6 Photo 90 Bath');
   end
else if choice = 2 then
   begin
        gotoxy (20,11);write('Price 12 Photo 120 Bath');
   end
else if choice = 3 then
   begin
        gotoxy (20,11);write('Enter amount :');
        readln(amount);
        price := amount * 50;
        gotoxy (20,11);writeln('amount =',price:5);
        total := amount + price;
        gotoxy (20,11);writeln('U price =',total:5);
   end
else
        begin
        writeln;
        gotoxy (20,14);writeln('Error , Only Enter 1,2,3, ':34);
        end;
        readln;
   end.

 

ด้วยฟังค์ชั่น ตอบด่วน คุณสามารถใช้โค๊ดและ เครื่องหมายแสดงอารมณ์ได้ เหมือนการตั้งกระทู้ธรรมดา แต่สามารถทำได้สะดวกกว่า

ระวัง: หัวข้อนี้ไม่มีการอัพเดทมานานถึง 120 วัน

แจ้งเตือน: โพสของคุณจะไม่แสดงจนกว่าผู้ดูแลจะอนุมัติ.
ชื่อ: อีเมล์: