c语言 12-2
1、
#include <stdio.h> #define NAME_LEN 64 typedef struct student{ char name[NAME_LEN]; int height; float weight; long schols; }Student; void judg(Student *x) { if(x -> height < 180) x -> height = 180; if(x -> weight > 80) x -> weight = 80; } int main(void) { Student sanata; printf("sanata.name: "); scanf("%s", sanata.name); printf("sanata.height: "); scanf("%d", &sanata.height); printf("sanata.weight: "); scanf("%f", &sanata.weight); printf("sanata.schols: "); scanf("%ld", &sanata.schols); judg(&sanata); puts("\n==================================\n"); printf("sanata.name: %s\n", sanata.name); printf("sanata.height: %d\n", sanata.height); printf("sanata.weight: %.2f\n", sanata.weight); printf("santa.schols: %ld\n", sanata.schols); return 0; }