南城转暖 发表于 2020-10-9 18:23:14

不会写,帮着写一下C++

帮这些一下C++

永恒的蓝色梦想 发表于 2020-10-9 18:23:15

#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>

unsigned int count, tcount, temp, sum, statistic;



int main(void) {
        scanf("%u", &count);


        for (tcount = count; tcount; tcount--) {
                scanf("%u", &temp);
                sum += temp;


                if (temp <= 50) {
                        statistic++;
                }
                else if (temp <= 100) {
                        statistic++;
                }
                else if (temp <= 150) {
                        statistic++;
                }
                else if (temp <= 200) {
                        statistic++;
                }
                else if (temp <= 300) {
                        statistic++;
                }
                else {
                        statistic++;
                }
        }


        printf("%.2lf\n%u %u %u %u %u %u",
                (double)sum / count, statistic, statistic, statistic, statistic, statistic, statistic);
        return 0;
}
页: [1]
查看完整版本: 不会写,帮着写一下C++