구조체

it/programming

[c++] 구조체 포인터 node 관리 - insert

#include #include #include struct node { int data; struct node *next; }; struct node *node_insert(struct node *head, int cur_data,int insert_data); void list_print(struct node *); void main(){ struct node a, b, c; struct node *head; head=&a; a.data = 10; b.data = 20; c.data = 30; a.next= &b; b.next = &c; c.next = NULL; list_print(head); head = node_insert(head, 20, 5); list_print(head); } void l..

it/programming

[c++] 구조체 포인터 node 관리 - add

#include #include struct node { int data; struct node *next; }; struct node *node_add(struct node *head, int add_data); void list_print(struct node *); void main(){ struct node a, b, c; struct node *head; head=&a; a.data = 10; b.data = 20; c.data = 30; a.next= &b; b.next = &c; c.next = NULL; list_print(head); head = node_add(head, 50); list_print(head); } void list_print(struct node *head){ for(..

it/programming

[c++] 구조체 배열 실습

#include void JR(struct student st[]); struct student { int no; char name[50]; int kor,eng,mat,sum; float ave; char hak; }; void main() { struct student st[5]={{1,"김경민",89,75,70},{2,"노순희",67,56,80},{3,"민은희",90,100,89},{4,"이은하",75,86,96},{5,"황은영",90,89,79}}; for(int i=0;i=90) st[i].hak='A'; else if(st[i].ave>=80) st[i].hak='B'; else if(st[i].ave>=70) st[i].hak='C'; else if(st[i].ave>=60) st[i].ha..

반응형
훈솔
'구조체' 태그의 글 목록