C language Assignment 10

This work belongs to the curriculum C Programming Language II
Where the job requires https://edu.cnblogs.com/campus/zswxy/SE2019-4/homework/9832
My aim in this course is <Develop games>
This job helped me achieve that goal in terms of specific <Learn a switch statement, as well as defining a new function>
references <C language second edition, London and New York with Brian>

A .PTA lab assignments

1.1 Title name: 7-8 outputs a triangular array of characters (15 minutes)

This problem requires programming, the output from the n-th row begins uppercase A triangular array of the character.

Input format:
input line in a given positive integer n (1≤n <7).

Output format:
a triangular array of characters output by the n-th row of capital letters A start configuration. See sample output format, where each letter has a back space.

Sample input:
4
Output Sample:
ABCD
EFG
the HI
J

1.1.1 Data Processing

Data are expressed: the definition of n, count, i, j, the number of letters per line number will be described with i, j with the number of rows to be described.
Data treatment: for-for a desired number of interspersed repeated use, until the output of the last letter.

Fake code

#include <stdio.h>       

int main()    
{
    int n, count = 0;                       //定义n,count
    scanf("%d", &n);                        //输入n
    for (int i = n; i > 0; i--) {           //对于每行的字母数进行减一运算
        for (int j = 0; j < i; j++) {       //对于有多少行进行计算
            printf("%c ", 'A' + count);     //输出A后面的第几个字母,count为多少,输出就为A后面第几个字母
            count++;                        //对于A后面第几个数字进行累加
        }
        printf("\n");                       //输出空行
    }
    return 0;                               //返回主函数
}

1.1.2 Screenshot experiment code

1.1.3 build test data

Input data Input data Explanation
5 Description This triangle from AO
9 Description This triangle from AM
3 Description This triangle from the AF

1.1.4PTA submit a list and description

Compile Error: no spaces and commas forgotten.

1.2 Title name: 7-4 with the number (10 minutes) configuration

A number occurs exactly at the right end of the square of its number, this number is called the number isomorphic. To find the total number of isomorphism between 1 and 1000.

Output Format:
Output all isomorphic number satisfying the condition in a row, each output representing the number of six. No other additional formats and character.

输出样例:
1 5 6 25 76 376 625

1.2.1数据处理

数据表达:先搬出数学函数,在定义s,m,s用来累加,也就是对1~1000进行逐个算。
数据处理:然后用m对于s算的的条件进行承载,然后判断m的各个位数上是否有一个位数是等于s的。

伪代码

#include<stdio.h>
#include<math.h>                                              //数学函数的调用
int main()                              
{             
    int s, m;                                             //定义s,m
    for(s=1;s<=1000;s++)                                  //对于1~1000的数字逐个计算
    {
        m=pow(s,2);                                   //算出m的值,也就是将s平方
        if((m%10==s)||(m%100==s)||(m%1000==s))        //对于m各个位数上的数字的判断,即有任何一个位数等于s则满足条件
       {
            printf("%6d",s);                      //输出有六个空格间断的s
        }
    }
    return 0;                                             //返回主函数
}

1.2.2实验代码截图

1.2.3造测试数据

输入数据 输入数据 说明
输出1~1000的所有同构数

1.2.4 PTA提交列表及说明

1.格式错误:没有注意空格

二.代码互评

2.1同学代码截图

1.

2.

自己代码截图

1.代码一的比较

1.本质上没什么不同,只是对于累加量的赋值有所不同,还有条件的理解不同。我在前面就将没有的情况想到了,之后再判断是否为素数满足条件。
2.用到了sqrt()

2.代码二的比较

  1. 首先定义的量不同,她用到了flag。
  2. 运用的方法有很大不同。她用到了一些我没看到过的数据如sqrt()不知道啥东西。她还用到了count计数。

    三.学习总结

3.1学习进条度

周/日 这周所花时间 代码行 学到的知识简介 比较迷惑的问题
第四周 10 60
第五周 15 70
第六周 20 100
第七周 25 130
第八周 30 150 学会打累加 有时候打到的知识简介
第九周 35 180 学习了定义新函数 对于新函数的定义不是很理解
第十周 15 256 学了if-else语句 不会灵活应用if-else语句
第十一周 8 342 学了switch语句 不会运用switch语句
第十二周 7 435 学会了do-while语句 对于do-while语句的灵活运用
第十三周 5 324 学会了怎样使用穿插的循坏语句 对于题目的信息分解不行
第十四周 6 333 巩固了循环语句 对于难度大的循环语句还是不能快速掌握

3.2学习内容总结和感悟

3.2.1内容总结

3.2.2感悟

自我感觉越来越熟悉代码的结构与基础了,能够自己打出难度不是很大的代码了。
这让我信心大增,不在是个什么都不会的人了,所以我对以前七八九个小时的敲代码取得如今的一点点小进步而感到值得。
作业虽多但是真的很快乐。
作业量越来越多且难度越来越大,但现在效率有明显的提升。
我希望学习到更多的语句,以及很好玩的代码,我很喜欢打代码的感觉。
我相信自己以后会成功的开发出小游戏程序。
再次对自己说声加油。

Guess you like

Origin www.cnblogs.com/ysshhd/p/11950626.html