ข่าวสารทางเว็บ : เปิดสมัครสมาชิกใหม่แล้วนะครับ แต่ต้อง Login ด้วย facebook ก่อน
หน้า: [1]   ลงล่าง
  ส่งหัวข้อนี้  |  พิมพ์  
ผู้เขียน หัวข้อ: ช่วยทีนะครับ  (อ่าน 399 ครั้ง)
0 สมาชิก และ 2 บุคคลทั่วไป กำลังดูหัวข้อนี้
pakiniy99
Baby - C
*

Thank : 0 
ออฟไลน์ ออฟไลน์

กระทู้: 3


« เมื่อ: กันยายน 07, 2011, 11:46:15 am »

โจทย์บอกว่า : เขียนโปรแกรมในการคำนวณค่าล้างอัดรูปกับร้าน 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 pm โดย pakiniy99 » บันทึกการเข้า
dekpascal
Baby - C
*

Thank : 0 
ออฟไลน์ ออฟไลน์

กระทู้: 5


« ตอบ #1 เมื่อ: ตุลาคม 02, 2011, 02:13:36 pm »

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.
บันทึกการเข้า
หน้า: [1]   ขึ้นบน
  ส่งหัวข้อนี้  |  พิมพ์  
 
กระโดดไป:  

พื้นที่สนทนาภายในเว็บ it4x.com (เอาไว้คุยกันครับ)
ถูกใจเว็บ it4x.com กด Like เลย
Powered by MySQL Powered by PHP Powered by SMF 1.1.14 | SMF © 2006-2009, Simple Machines LLC | Sitemap Valid XHTML 1.0! Valid CSS!
eXTReMe Tracker
พฤษภาคม 20, 2012, 02:18:13 am
เวลาปัจจุบัน