C语言实验报告1
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
《程序设计基础》实验报告
{
float a, b;
printf_s("please input cost price of TV:");
scanf_s("%f", &a);
b = a*K;
printf_s("the current price of TV:");
printf_s("%f", b);
return 0;
2、
#include"stdafx、h"
int main()
{
int a, b, c, d, e, f;
printf_s("please input three figures:");
scanf_s("%d", &a);
b = a / 100;
c = a % 100;
d = c / 10;
e = c % 10;
f = e * 100 + d * 10 + b;
printf_s("the new three figures:");
printf_s("%d", f);
return 0;
}
3、
#include"stdafx、h"
int main()
{
float a, b, c, d, e;
printf_s("please input scores:\n");
scanf_s("%f%f%f", &a, &b, &c);
d = a + b + c;
e = (a + b + c) / 3;
printf_s("the total scores:");
printf_s("%5、1f\n", d);
printf_s("the average scores:");
printf_s("%4、1f\n", e);
return 0;
}
4、
#include"stdafx、h"
int main()
{
float a, b;
printf("please input a number:");
scanf_s("%f", &a);
printf_s("the integer part is:");
printf_s("%d\n", (int)a);
b = a - (int)a;
printf_s("the decimal part is:");
printf_s("%2、1f", b);
return 0;
}
5、
#include"stdafx、h"
int main()
{
int x, d, s;
x = 298;
d = x / 60;
s = x % 60;
printf_s("the minnutes is:");
printf_s("%d\n", d);
printf_s("the seconds is:");
printf_s("%d", s);
return 0;
}
实验总结:
1、初步熟悉C语言运行环境,了解与使用Visual C++ 6、0集成开发环境;
2、更加熟悉Visual C++ 6、0环境的功能键与常用的功能菜单命令;
3、明白C语言程序的书写格式与C语言程序的结构;
4、更加了解了C语言的上机步骤,以及编辑、编译与运行一个C程序的方法;
5、初步熟悉Visual C++
6、0环境下的程序调试方法。
6、熟悉了取余与取整的符号使用
7、明白了定义变量的含义以及不同的数型
评阅意见:本次实验报告书写格式规范;目的明确,报告内容有错误分析与错误改进,但无错误截图,记录详细;实验总结恰当。