标签:return .net 地方 分享图片 style getc for scanf 流程图
一.学习要点。
二.程序。
#include <stdio.h> struct student{ char numbers[6]; char name[10]; int socre; }student_1[10]; int main(){ int N, i, j; int count[10]; float sum; scanf(" %d ", &N); for(i = 0, j = 0; i < N; i++) { scanf("%s %s %d", student_1[i].numbers, student_1[i].name, &student_1[i].socre); sum = sum + student_1[i].socre; } printf("%.2f\n", sum/N); j=0; while(j < N) { if(student_1[j].socre < sum/N) printf("%s %s\n", student_1[j].name, student_1[j].numbers); j++; } return 0; }
#include <stdio.h> struct book{ char name[50]; double price; }book_1[10]; int main() { int i, n, count[2] = {0, 0}; scanf("%d", &n); getchar(); gets(book_1[0].name); scanf("%lf", &book_1[0].price); getchar(); for(i = 1; i < n; i++){ gets(book_1[i].name); scanf("%lf", &book_1[i].price); getchar(); if(book_1[i].price <= book_1[count[1]].price) count[1] = i; if(book_1[i].price > book_1[count[0]].price) count[0] = i; } i=0; while(i<2) { printf("%.2lf, %s\n", book_1[count[i]].price, book_1[count[i]].name); i++; } return 0; }
标签:return .net 地方 分享图片 style getc for scanf 流程图
原文地址:https://www.cnblogs.com/boke2017boke/p/8905870.html