《程序设计基础》实验报告
{
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.明白了定义变量的含义以及不同的数型
评阅意见:本次实验报告书写格式规范;目的明确,报告内容有错误分析和错误改进,但无错误截图,记录详细;实验总结恰当。