วันอังคารที่ 30 มิถุนายน พ.ศ. 2552
วันจันทร์ที่ 29 มิถุนายน พ.ศ. 2552
การบ้าน"Structure"
struct date{
int day;
int month;
int year;
};
struct mobile{
char brand[20];
char modle[20];
char color[10];
int item;
float price;
struct date date1;
}mobile1;
ตัวอย่างการเขียนโปรแกรม
#include
#include
void main ()
{
struct date{
int day;
int month;
int year;
};
struct mobile{
char brand[20];
char modle[20];
char color[10];
int item;
float price;
struct date date1;
}mobile1;
strcpy(mobile1.brand,"nokia");
strcpy(mobile1.modle,"N72");
strcpy(mobile1.color,"black");
mobile1.item=1;
mobile1.price=7800;
mobile1.date1.day=17;
mobile1.date1.month=04;
mobile1.date1.year=2550;
printf("\t\t\tmobile\n\n");
printf("brand:%s\n\n",mobile1.brand);
printf("modle:%s\n\n",mobile1.modle);
printf("color:%s\n\n",mobile1.color);
printf("item:%d\n\n",mobile1.item);
printf("price:%f\n\n",mobile1.price);
printf("day:%d\n\n",mobile1.date1.day);
printf("month:%d\n\n",mobile1.date1.month);
printf("year:%d\n\n",mobile1.date1.year);
printf("\t\t\tend\n");
}
int day;
int month;
int year;
};
struct mobile{
char brand[20];
char modle[20];
char color[10];
int item;
float price;
struct date date1;
}mobile1;
ตัวอย่างการเขียนโปรแกรม
#include
#include
void main ()
{
struct date{
int day;
int month;
int year;
};
struct mobile{
char brand[20];
char modle[20];
char color[10];
int item;
float price;
struct date date1;
}mobile1;
strcpy(mobile1.brand,"nokia");
strcpy(mobile1.modle,"N72");
strcpy(mobile1.color,"black");
mobile1.item=1;
mobile1.price=7800;
mobile1.date1.day=17;
mobile1.date1.month=04;
mobile1.date1.year=2550;
printf("\t\t\tmobile\n\n");
printf("brand:%s\n\n",mobile1.brand);
printf("modle:%s\n\n",mobile1.modle);
printf("color:%s\n\n",mobile1.color);
printf("item:%d\n\n",mobile1.item);
printf("price:%f\n\n",mobile1.price);
printf("day:%d\n\n",mobile1.date1.day);
printf("month:%d\n\n",mobile1.date1.month);
printf("year:%d\n\n",mobile1.date1.year);
printf("\t\t\tend\n");
}
วันเสาร์ที่ 27 มิถุนายน พ.ศ. 2552
DTS 02-24-06-2552
สรุปเนื้อหาบทเรียน "Data Structure"
เรื่อง Array and Record
Array
อาร์เรย์ คือ กลุ่มตัวแปรชนิดเดียวกันที่ใช้ชื่อเดียวกัน อาร์เรย์จะมีตัวห้อยหรือ subscript เป็นตัวระบุจำนวนสมาชิก อาร์เรย์จะแบ่งออกเป็น
1.อาร์เรย์มิติเดียว คือจะเก็บข้อมูลในแถวเดียวไม่ว่าจะเป็นแนวนอน หรือ แนวตั้ง รูปแบบของอาร์เรย์มิติเดียว
= ชนิดของตัวแปร ชื่อของตัวแปร ขนาดของตัวแปรอาร์เรย์ เช่น int num [5]
2.อาร์เรย์หลายมิติ จะมี 2 มิติ หรือ 3 มิติ จะแตกต่างจากอาร์เรย์มิติเดียวตรงที่ตัวห้อย คือ ตัวห้อยของอาร์เรย์จะมีขนาดของแถวและขนาดของคอลัมม์มาเป็นตัวบอกจำนวนสมาชิกด้วย รูปแบบของอาร์เรย์มิติหลายมิติ
= ชนิดของตัวแปร ชื่อของตัวแปร ขนาดของแถว ขนาดของคอลัมม์ เช่น int num [2][3]
* กรณีถ้ามีการกำหนดค่าให้กับตัวแปรชนิด character ขนาดของอาร์เรย์ก็จะมีขนาดเพิ่มขึ้นจากเดิมมาหนึ่งค่า เพื่อเก็บ "\0" จะทำหน้าที่บอกการสิ้นสุดของสายอักษร
Structure
คือ โครงสร้างข้อมูลที่มีประเภทข้อมูลแตกต่างชนิดกันได้ สมาชิกอาจเป็น จำนวนเต็ม ทศนิยม พอยเตอร์ ก็ได้
เมื่อต้องการอ้างถึงตัวแปรในโครงสร้างของ structure จะใช้ . มาเป็นตัวอ้าง เช่น personal.name
ประวัติส่วนตัว
ชื่อ-สกุล นางสาวกานต์รวี พัวประเสริฐ (Miss. Kanrawee Puaprasert)
ชื่อเล่น "มีน" ("Meen")
เกิดวันที่ 16 เมษายน 2532
อายุ 20 ปี
ที่อยู่ปัจจุบัน 99/138 ซอยเสนานิคม ถนน พหลโยธิน เเขวง ลาดพร้าว เขต ลาดพร้าว
จังหวัด กรุงเทพมหานคร 10230
E-mail meenz_aa @hotmail.com
คติพจน์ การดำเนินชีวิตโดยปราศจากเป้าเหมาย ก็เหมือนกับการเเล่นเรือโดยปราศจากเข็มทิศ
ปัจจุบันศึกษาอยู่ที่ มหาวิทยาลัยราชภัฏสวนดุสิต
คณะวิทยาการจัดการ หลักสูตรการบริหารธุรกิจ (คอมพิวเตอร์ธุรกิจ)
สมัครสมาชิก:
บทความ (Atom)