测试环境visual studio 2019
若要运用于其他环境请将scanf_s这类函数后面的_s去除。
看到末尾那个大大的赏字了嘛,赶紧点开扫描二维码,就可以给贫穷的琥珀提供饭钱。
QAQ

126-8

//计算学生得分
//date:25/10/2019
//code by kohaku   All rights reserved.

#include<stdio.h>
#include <iostream>

int main()
{
    int student[5][5] = { 0 };
    int total[5] = { 0 };
    int avg_s[5] = { 0 };
    int avg_c[5] = { 0 };
    int cmax[5] = { 0 };
    int cmin[5] = { 0 };
    for (int i = 0; i < 5; i++) {
        printf("Enter the student%d:", i + 1);
        for (int n = 0; n < 5; n++) {
            scanf_s("%d", &student[i][n]);
        }
    }
    //计算总分
    for (int i = 0; i < 5; i++) {
        for (int n = 0; n < 5; n++) {
            total[i] += student[i][n];
        }
    }
    printf("total scores:\t%d\t%d\t%d\t%d\t%d\n", total[0], total[1], total[2], total[3], total[4]);
    //计算平均分
    for (int i = 0; i < 5; i++) {
        avg_s[i] = total[i] / 5;
    }
    printf("avg scores:\t%d\t%d\t%d\t%d\t%d\n", avg_s[0], avg_s[1], avg_s[2], avg_s[3], avg_s[4]);
    //计算每门平均分
    for (int i = 0; i < 5; i++) {
        for (int n = 0; n < 5; n++) {
            avg_c[i] += student[n][i];
        }
        avg_c[i] /= 5;
    }
    printf("avg class:\t%d\t%d\t%d\t%d\t%d\n", avg_c[0], avg_c[1], avg_c[2], avg_c[3], avg_c[4]);
    //计算每门最高分
    for (int i = 0; i < 5; i++) {
        for (int n = 0; n < 5; n++) {
            if (cmax[i] < student[n][i])cmax[i] = student[n][i];
        }
    }
    printf("highest scores:\t%d\t%d\t%d\t%d\t%d\n", cmax[0], cmax[1], cmax[2], cmax[3], cmax[4]);
    //计算每门最低分
    for (int i = 0; i < 5; i++) {
        cmin[i] = student[0][i];
        for (int n = 1; n < 5; n++) {
            if (cmin[i] > student[n][i])cmin[i] = student[n][i];
        }
    }
    printf("lowest scores:\t%d\t%d\t%d\t%d\t%d\n", cmin[0], cmin[1], cmin[2], cmin[3], cmin[4]);
}

127-14

//逆向输出句子
//date:25/10/2019
//code by kohaku   All rights reserved.

#include<stdio.h>
#include <iostream>

int main()
{
    char str[1000];
    char end;
    int i = 0;
    char* p;
    printf("Enter a sentence:");
    //读取句子,将所以空格处理为\0,遇到结束符停止
    while (1) {
        str[i] = getchar();
        if (str[i] == 32)str[i] = '\0';
        if (str[i] == 33 || str[i] == 63 || str[i] == 46)break;
        i++;
    }
    printf("Reversal of sentence:");
    //存储结束符,将结束符变为\0
    end=str[i];
    str[i] = '\0';
    //向前搜索,遇到\0时,将指针移动到下一格,以字符串输出
    for (int n=i-1; n >= 0; n--) {
        if (str[n] =='\0') {
            p = &str[n+1];
            printf("%s ", p);
        }
    }
    //输出第一个单词
    printf("%s", str);
    printf("%c", end);
}

127-15

//这是一个凯撒加密算法
//date:25/10/2019
//code by kohaku   All rights reserved.

#include<stdio.h>
#include <iostream>

int main()
{
    char str[80] = { 0 };
    int num = 0;
    int i = 0;
    int move = 0;
    printf("Enter message to be encrypted:");
    //逐个读取字符并计数,遇到结束符停止
    while (1) {
        str[i] = getchar();
        if (str[i] == 33 || str[i] == 63 || str[i] == 46)break;
        i++;
    }
    //最后添加一个终止符
    str[i+1] = '\0';
    printf("Enter shift amount(1-25):");
    scanf_s("%d", &move);
    //加密过程
    for (int n = 0; n < i; n++) {
        if (str[n]==32||str[n]==44)continue;
        else if (str[n] >= 97)str[n] = ((str[n] - 'a') + move) % 26 + 'a';
        else str[n] = ((str[n] - 'A') + move) % 26 + 'A';
    }
    printf("Encrypted message:%s", str);
}

128-16

//比较单词字母数量是否相同
//date:25/10/2019
//code by kohaku   All rights reserved.

#include<stdio.h>
#include<ctype.h>
#include <iostream>

int main()
{
    char first[100] = { 0 };
    char second[100] = { 0 };
    int cfi[26] = { 0 };
    int cse[26] = { 0 };
    int f = 0, s = 0;
    //循环输入每一个字母,并判断当该字母是字母时,将该字母的转换为小写,并从数值上减去97,作为数组变量名输入
    printf("Enter first word:");
    while (1) {
        first[f] = getchar();
        if (isalpha(first[f]) != 0) {
            cfi[(tolower(first[f]) - 97)] += 1;
        }
        else break;
        f++;
    }
    printf("Enter second word:");
    while (1) {
        second[s] = getchar();
        if (isalpha(second[s]) != 0) {
            cse[(tolower(second[s]) - 97)] += 1;
        }
        else break;
        s++;
    }
    //判断如果每一种字母数量都相同就判断为true
    for (int b = 0; b < 26; b++) {
        if (cfi[b] != cse[b]) {
            printf("The words are not anagrams.");
            break;
        }
        if (b == 25) {
            printf("The words are anagrams.");
        }
    }
}

222-1

//判断哪个单词“大”或“小”
//date:26/10/2019
//code by kohaku   All rights reserved.

#include<stdio.h>
#include<stdlib.h>
#include <iostream>

int main()
{
    char op[20] = {0};
    char smallest[20] = { 0 };
    char largest[20] = {0};
    int i = 0;
    //循环判断单词,每次与前一个单词比较
    while (1) {
        printf("Enter word:");
        gets_s(op);
        //进行第一次输入的赋值
        if (i == 0) {
            strcpy_s(smallest, op);
            strcpy_s(largest, op);
        }
        if(strcmp(smallest, op)>0)strcpy_s(smallest, op);
        if (strcmp(largest, op) < 0)strcpy_s(largest, op);
        if (strlen(op) == 4)break;
        i++;
    }
    printf("\nSmallest word:%s\n", smallest);
    printf("Largest word:%s", largest);
}

222-18

//输入日月的转换
//date:26/10/2019
//code by kohaku   All rights reserved.

#include<stdio.h>
#include <iostream>

int main()
{
    //定义二维数组,第一位变量存储月份,第二位存储月份名称
    char month[12][10] = {
        "January","February","March","April","May","june",
        "july","August","September","October","November","December" };
    int mon, day, year;
    printf("Enter a date(mm/dd/yyyy):");
    scanf_s("%d\/%d\/%d", &mon, &day, &year);
    printf("You entered the date %s %d,%d", month[mon-1], day, year);
}

吾辈名为秋月琥珀,今后也请多多关照了