明解C語言入門篇(第12章練習題)

2021-09-12 06:10:47 字數 2350 閱讀 9388

#include

#define name_len 64

struct student

;int

main

(void);

printf

("姓名 = %s\n"

, takao.name)

;printf

("身高 = %d\n"

, takao.height)

;printf

("體重 = %.1f\n"

, takao.weight)

;printf

("獎學金 = %ld\n"

, takao.schols)

;printf

("姓名的位址為%p\n"

,&takao.name)

;printf

("身高的位址為%p\n"

,&takao.height)

;printf

("體重的位址為%p\n"

,&takao.weight)

;printf

("獎學金的位址為%p\n"

,&takao.schols)

;return0;

}

#include

#define name_len 64

struct student

;void

hiroko

(struct student *std)

intmain

(void

)

#include

struct xyz

;struct xyz scan_xyz

(int a,

long b,

double c)

;int

main

(void);

printf

("請輸入a, b, c的值。\n");

printf

("a: ");

scanf

("%d"

,&a)

;printf

("b: ");

scanf

("%ld"

,&b)

;printf

("c: ");

scanf

("%lf"

,&c)

; s2 =

scan_xyz

(a, b, c)

;printf

("%d %ld %lf\n"

, s2.a, s2.b, s2.c)

;return0;

}

#include

#include

#define number 5

#define name_len 64

typedef

struct

student;

void

swap_student

(student *x, student *y)

void

sort_by_height_or_name

(student a,

int n)}}

if(temp ==1)

}}}int

main

(void

)sort_by_height_or_name

(std, number)

;puts

("\n排序如下。");

for(i =

0; i < number; i++

)return0;

}

#include

#include

#define sqr(n) ((n) * (n))

typedef

struct

point;

typedef

struct

car;

double

distance_of

(point pa, point pb)

void

put_info

(car c)

intmove

(car *c, point dest)

intmain

(void),

90.0};

while(1

)if(temp ==0)

}if(!

move

(&mycar, dest)

)puts

("\a燃料不足無法行駛。");

}return0;

}

明解C語言 入門篇 第七章練習題

include intmain include include intmain include unsigned rrotate unsigned x,int n unsigned lrotate unsigned x,int n intmain printf 輸入錯誤!請重新輸入!n if a 1...

明解C語言入門篇練習題第四章

練習4 1 include int main void return 0 練習4 2 include int main void printf 大於等於 d小於等於 d的所有整數的和是 d。n min,max,sum return 0 練習4 3 include int main void if n...

明解C語言入門篇練習題第六章

練習6 1 include int min2 int a,int b int main void 練習6 2 include int min3 int a,int b,int c int main void 練習6 3 include int cube int x int main void 練習6...