วันอังคารที่ 30 มิถุนายน พ.ศ. 2552

ทำ Structure เกี่ยวกับการซื้อโทรศัพท์
#include "stdio.h"
struct date
{int day;
int month;
int year;
}days;struct mobile
{
char brand[20];
char modle[20];
char color[10];
int item;
float price;
}phone;
void main()
{
printf("Wellcome to Atomtelephone\n");
printf("day:");scanf("%d",&days.day );
printf("month:");scanf("%d",&days.month);
printf("year:");
scanf("%d",&days.year);
printf("Mobile brand:");
scanf("%s",&phone.brand);
printf("Modle is:");
scanf("%s",&phone.modle);
printf("color:");
scanf("%s",&phone.color);
printf("item:");
scanf("%s",&phone.item);
printf("price :");
scanf("%f",&phone.price);
{printf("Date:%d/%d/%d\n",days.day,days.month,days.year);
printf("Mobile brand: %s\n",phone.brand);
printf("Phone modle: %s\n",phone.modle);
printf("Color: %s\n",phone.color);printf("Buy: %s Item",phone.item);
printf("Price: %f",phone.price);
}
}

สรุปการเรียน Lecture2 Array and Record

1 ได้รู้จักประเภทและการดำเนินการของ อะเรย์

2อะเรย์นั้นมี2ประเภทคือ

2.1 อะเรย์1มิติ

2.2อะเรย์หลายมิติ

3เพื่อให้ทราบความสัมพันธ์ของเรคคอร์ดกับอะเรย์

4 ได้รู้จักการกำหนดอะเรย์ และ subscript

5 การได้รู้จักโครงสร้างหรือ Structure

6 รู้จักการการทำงานและหน้าที่ของ pointer