วันพฤหัสบดีที่ 22 มกราคม พ.ศ. 2552

C++ ? ? ....

คืองี้
ครูให้เราทำโปรแกรมคำนวนราคาสินค้าห้าชิ้น
โดย

1 กำหนดราคาสินค้า
2 กำหนดจำนวน
3 แสดง ราคารวม ภาษี 7% และ ทั้งหมด

ไอเราก็ได้ทำแล้วส่งครู

แต่วันต่อมา นึกอะไรก็ไม่รุ


เจือกอยากทำใหม่
ดันไฉไลกว่าเก่า
-------------------------------------------------------------------[เขียนกะ Dev-c++ นะ]
อ่อ แล้วถ้ามีเสียงไม่ต้องตกใจนะ ทำเล่นๆ XD

#include "stdio.h"
#include "conio.h"
//แก้เป็นเครื่องหมาย <>น้อยกว่ากับมากกว่ามาครอบแทน " " ด้วยนะ
int o1,o2,o3,o4,o5;
foat p1,p2,p3,p4,p5,q1,q2,q3;
main()

{

//first step
//enter the price

printf("Welcome to my counting program beta by Arthar_O\n\npress any key to continue\n\n");
printf("----------\n");
getch();
printf("\a\a--------------------\nEnter the price of P1 price\n");
scanf(" %f",&p1); printf("Enter the price of P2 price\n\a");
scanf(" %f",&p2);
printf("Enter the price of P3 price\n\a");
scanf(" %f",&p3);
printf("Enter the price of P4 price\n\a");
scanf(" %f",&p4);
printf("Enter the price of P5 price\n\a");
scanf(" %f",&p5);
printf("\a--------------------\nyour price is\n\n");

printf("P1=%.2f baht\nP2=%.2f baht\nP3=%.2f baht\nP4=%.2f baht\nP5=%.2f baht\n\a\a",p1,p2,p3,p4,p5);

printf("--------------------\n");

//scond step
//Enter the number of product

printf("\a--------------\nEnter the number of P1 \n");
scanf(" %d",&o1);
printf("Enter the number of P2 \n\a");
scanf(" %d",&o2);
printf("Enter the number of P3 \n\a");
scanf(" %d",&o3);
printf("Enter the number of P4 \n\a");
scanf(" %d",&o4);
printf("Enter the number of P5 \n\a");
scanf(" %d",&o5);
printf("\a--------------------\nyour number is\n\n");
printf("P1=%d \nP2=%d \nP3=%d \nP4=%d \nP5=%d \n",o1,o2,o3,o4,o5);
printf("--------------------\n\nThere are\n\a\a");

//calculate
//price * number

q3 = (p1*o1)+(p2+o2)+(p3+o3)+(p4+o4)+(p5+o5); //VAT. q1 = (q3*7)/100;

//Total.

q2 = q3+q1;
// print

printf("--------------------\a\n all = %.2f\tbaht\n VAT = %.2f\t\tbaht\a\n total = %.2f\tbaht\n--------------------\n",q3,q1,q2);

printf("\n\nThank you\n\n--------------------\n------------------\n-----------------\n---------------\n------------\n");
getch();

}

จบ

มีปัญหาอะไรถามได้ (แนะนำอะไรก็ได้นะ)
---------------------------------------------------------copy ได้นะ ไม่กัด

ถ้าอยากทำเป็นก็หาเรียนได้

รู้สึกมีเว็บนึง ดีมากเลย (ถึงแม้จะยัง งง อยู่ก็ตาม)

http://203.146.122.12/nattee/cpp/4_InputOutput.htm#endl

นี้อะ

แล้วก็ นี้คือพื้นฐาน ภาษา C

http://72.14.235.132/search?q=cache:rBuNXiJJJEIJ:www.samsenwit.ac.th/index_files/Posn/com2549/SharFile/C/C_1.ppt+clrscr+Preprocessing+Directive&hl=th&ct=clnk&cd=10&gl=th

อืม แค่นี้แหละ



บะบาย
-------------------

ไม่มีความคิดเห็น:

แสดงความคิดเห็น