这个作业属于哪个课程:https://edu.cnblogs.com/campus/fzu/2026gjyycxsj
这个作业要求在哪里: https://edu.cnblogs.com/campus/fzu/2026gjyycxsj/homework/16749
学号:0102600135
姓名:林梓涵
(1)代码演示:
1
include<stdio.h>
include <string.h> // provides strlen() prototype
define PRAISE "What a super marvelous name!"
int main(void)
{
char name[40];
printf("What's your name?\n");
scanf("%s", name);
printf("Hello, %s. %s\n", name, PRAISE); printf("Your name of %d letters occupies %d memory cells.\n", strlen(name), sizeof name); printf("The phrase of praise has %d letters ", strlen(PRAISE));
printf("and occupies %d memory cells.\n", sizeof PRAISE); }

2
include<stdio.h>
define SQUARES 64 //棋盘上的方格数
define CROP 1E15 //以粒计的美国小麦产量
int main(void)
{
double current, total;
int count = 1;
printf("square grains total ");
printf("fraction of \n");
printf(" added grains ");
printf("US total\n");
total = current = 1.0; // start with one grain
printf("%4d %13.2e %12.2e %12.2e\n", count, current, total, total/CROP);
while (count < SQUARES)
{
count = count + 1;
current = 2.0 * current;
total = total + current; // update total
printf("%4d %13.2e %12.2e %12.2e\n", count, current, total, total/CROP);
}
printf("That's all.\n"); }


3
include<stdio.h>
int main(void)
{
char ch; int i;
float fl;
fl = i = ch = 'C';
printf("ch = %c, i = %d, fl = %2.2f\n", ch, i, fl);
ch = ch + 1;
i = fl + 2 * ch;
fl = 2.0 * ch + i;
printf("ch = %c, i = %d, fl = %2.2f\n", ch, i, fl);
ch = 5212205.17;
printf("Now ch = %c\n", ch); return 0; }

4
include <stdio.h>
void pound(int n);
void main()
{
int times = 5;
char ch = '!';
float f = 6.0;
pound(times);
pound(ch);
pound((int) f);
}
void pound(int n)
{
while (n-- > 0)
printf("#");
printf("\n"); }

(2)课本练习
4.8.2


4.8.3


4.8.4


4.8.6


4.8.7


4.8.8


5.11.1


5.11.2


5.11.3


5.11.4


5.11.5


5.11.6


5.11.7


5.11.8


5.11.9


(3)设计作业


总结:巧妙借助AI工具,对课堂知识进行了反思优化
浙公网安备 33010602011771号