标签:for c++ int 数组 can print code log turn
1 #include <stdio.h> 2 #include <stdlib.h> 3 4 struct student{ 5 int num; 6 char str[20]; 7 double dec; 8 }; 9 10 void scan(struct student stu[], int *n){ 11 scanf("%d", n); 12 for(int i = 0; i < *n; ++i){ 13 scanf("%d%s%lf", &stu[i].num, stu[i].str, &stu[i].dec); 14 } 15 } 16 17 void print(struct student stu[], int n){ 18 printf("%d\n", n); 19 for(int i = 0; i < n; ++i){ 20 printf("%d %s %lf\n", stu[i].num, stu[i].str, stu[i].dec); 21 } 22 } 23 24 int main(){ 25 int n; 26 struct student stu[10]; 27 28 scan(stu, &n); 29 print(stu, n); 30 31 return 0; 32 } 33 /* 34 3 35 20 字符串0 20.02 36 21 字符串1 21.12 37 22 字符串2 22.22 38 */
标签:for c++ int 数组 can print code log turn
原文地址:http://www.cnblogs.com/xuqiulin/p/6159530.html