– เรื่อง แปลงหน่วยวัดอเนกประสงค์
ในชีวิตประจำวันเราจะต้องเจอหน่วยวัดที่รู้จักและไม่รู้จักเยอะมาก เราจึงคิดโปรแกรมที่จะมาทำให้มันง่ายขึ้น สำหรับคนที่จำไม่ได้หรือบางทีอาจลืมไป แต่มีโปรแกรมเรา จะไม่หลงลืมอีกแน่นอน
– Psuedo Code
– Flowchart
– Source Code
#include <stdio.h>
#include<conio.h>
void main(void) { int ch=1; float x1,y2; do { printf(“========MODE==============\n”);
printf(“1. FOOT -> Inches\n”); printf(“2. INCHES -> Meters\n”);
printf(“3. Meters -> Centimeters\n”);
printf(“4. Centitmeters -> Milimeters\n”);
printf(“5. Kilomenters- > Meters\n”);
printf(“0. ======>EXIT<============\n”);
printf(“Select MODE IS = : “);
scanf(“%d”,&ch); if(ch == 1) {
printf(“Input Value Foot\n”);
scanf(“%f”,&x1); y2=x1*12;
printf(” ===============>%.2f foot ==> %.2f inches \n”,x1,y2); x1=y2/12;
printf(” ===============>%.2f inches ==> %.2f foot \n\n”,y2,x1); }
if (ch ==2) { printf(“Input Value Inches\n”);
scanf(“%f”,&x1); y2=x1*39.3700787;
printf(” ===============>%.2f Inches ==> %.2f Meters \n”,x1,y2); x1=y2/39.3700787;
printf(” ===============>%.2f Meters ==> %.2f Inches \n\n”,y2,x1); }
if (ch==3) { printf(“Input Value Meters\n”);
scanf(“%f”,&x1); y2=x1/100; printf(” ===============>%.2f Meters ==> %.2f Centimeters \n”,x1,y2); x1=y2*100;
printf(” ===============>%.2f Centimeters ==> %.2f Meters \n\n”,y2,x1); } if(ch ==4) {
printf(“Input Value Centimeters\n”);
scanf(“%f”,&x1); y2=x1/10;
printf(” ===============>%.2f Centimeters ==> %.2f milimeters \n”,x1,y2); x1=y2*10;
printf(” ===============>%.2f milimeters ==> %.2f Centimeters \n\n”,y2,x1); }
if(ch ==5) {
printf(“Input Value Kilometers\n”);
scanf(“%f”,&x1); y2=x1/1000;
printf(” ===============>%.2f Kilometers ==> %.2f Meters \n”,x1,y2);
x1=y2*1000;
printf(” ===============>%.2f Meters ==> %.2f Kilometers \n\n”,y2,x1); } }
while (ch !=0); getch(); }
– Run PROGRAM -> รูป OUTPUT
รายชื่อสมาชิก
นายเรวัตร ยั่งยืน 1570900611
นายศักดิติ จอนกิ่ง 1570900629
นายชาคริต เคร่งธรรมกิจ 1570901411