structstu
struct stu stu1, stu2;
structstu stu1, stu2;
struct stu1, stu2;
#include intmain() stu1;
//給結構體成員賦值
stu1.name = "
tom"
; stu1.num = 12
; stu1.age = 18
; stu1.group = 'a'
; stu1.score = 136.5
;
//讀取結構體成員的值
printf("
%s的學號是%d,年齡是%d,在%c組,今年的成績是%.1f!\n
", stu1.name, stu1.num, stu1.age, stu1.group, stu1.score);
return0;
}
structstu1, stu2 = ;
structstuclass[5];
structstuclass[5] =,,,
,};
structstuclass =,,,
,};
structstu stu1 = ;
//結構體指標
struct stu *pstu = &stu1;
structstu stu1 = , *pstu = &stu1;
#include intmain() stu1 = , *pstu = &stu1;
//讀取結構體成員的值
printf("
%s的學號是%d,年齡是%d,在%c組,今年的成績是%.1f!\n
", (*pstu).name, (*pstu).num, (*pstu).age, (*pstu).group, (*pstu).score);
printf(
"%s的學號是%d,年齡是%d,在%c組,今年的成績是%.1f!\n
", pstu->name, pstu->num, pstu->age, pstu->group, pstu->score);
return0;
}
enum week;enum week a = mon, b = wed, c = sat;
//定義乙個結構體,型別為struct student
2struct
student 3;
89//定義了乙個結構體,型別為struct student;且定義了乙個結構體例項,名叫stu
10struct
student
11stu;
1617
//定義了無名的結構體,且定義了乙個結構體例項,名叫stu
18struct
19stu;
2425
//重定義結構體,型別為struct student 或者是stu
26 typedef struct
student
27stu;
3233
//重定義結構體,型別為stu
ns_enum,定義狀態等普通列舉
typedef ns_enum(nsuinteger, ttgstate) ;
//ns_options,定義選項
typedef ns_options(nsuinteger, ttgdirection) ;
演算法知多少,漫漫offer長路 汽水瓶
題目描述 有這樣一道智力題 某商店規定 三個空汽水瓶可以換一瓶汽水。小張手上有十個空汽水瓶,她最多可以換多少瓶汽水喝?答案是5瓶,方法如下 先用9個空瓶子換3瓶汽水,喝掉3瓶滿的,喝完以後4個空瓶子,用3個再換一瓶,喝掉這瓶滿的,這時候剩2個空瓶子。然後你讓老闆先借給你一瓶汽水,喝掉這瓶滿的,喝完以...
2 我自己寫的閏年程式,長路漫漫,同志加油啊
我自己寫的閏年程式 include include include int main 報錯14處,實在是毫無可取之處,腦子是個漿糊。再看看別人的。include include include int main int year 0 printf 請輸入1000 2000的年份 n scanf d ...