struct argument includestdio h void printstruct history struct

  • Slides: 21
Download presentation

struct ���� การสงผานขอมลแบบ argument #include<stdio. h> void print(struct history); struct history { int id;

struct ���� การสงผานขอมลแบบ argument #include<stdio. h> void print(struct history); struct history { int id; char name[20]; char faculty[25]; } student; void print(struct history std) { } printf ("nt ID : %d nt Name : %s nt Faculty: %s", std. id, std. name, std. faculty); int main () { printf ("Enter id : "); scanf ("%d", &student. id); printf ("Enter name : "); scanf ("%s", student. name); printf ("Enter faculty : "); scanf ("%s", student. faculty); printf ("nstudent detail"); print(student); return 0; } Struct 1_2. c created by Dararat Saeleee , 344 -211 Algorithmic Process & Programming 19

การสงผานขอมลแบบ argument typedef struct { int roomno ; char name [15]; int age ;

การสงผานขอมลแบบ argument typedef struct { int roomno ; char name [15]; int age ; char sex ; } Detail; #define size 4 Detail customer [size] ; void range(Detail c[ ]); void main() { …. . range(customer); …} Demo struct 2_2. c struct ���� void range (Detail c[ ]) { int i, minage=999, maxage=0; for(i=0; i<size; i++) { if (c[i]. age < minage) minage = c[i]. age; if (c[i]. age > maxage) maxage = c[i]. age; } printf("age range = %d %dn", minage, maxage); } created by Dararat Saeleee , 344 -211 Algorithmic Process & Programming 20

Class Exercise �เขยนโปรแกรมภาษาซเพอพมพรายงานผลการเร ยน ดงน 344 -201 C programming 322 -212 Basic Math 890

Class Exercise �เขยนโปรแกรมภาษาซเพอพมพรายงานผลการเร ยน ดงน 344 -201 C programming 322 -212 Basic Math 890 -200 English 1 GPA = 3. 05 3 B+ 4 C 3 A Status = Pass created by Dararat Saeleee , 344 -211 Algorithmic Process & Programming