- 42
- 0
- 约6千字
- 约 13页
- 2017-03-03 发布于湖北
- 举报
C语言----实验一二讲述
实验一 最简单的C程序---顺序程序设计
(验证性实验 2学时)
(一)、实验目的
1.熟悉VC++6.0/C-Free等C语言程序编译软件运行环境
2.掌握运行一个C程序的步骤,理解并学会C程序的编辑、编译、链接方法
3.掌握C语言中使用最多的一种语句——赋值语句
4.掌握数据的输入输出方法,能正确使用各种格式控制符
(二)、实验内容
1.写出下列程序的运行结果
(1)#include stdio.h
void main()
{
printf(“*****************\n”);
printf(“This is a c program. \n”);
printf(“****************\n”);
}
运行结果及分析:
将程序中的\n去掉后,运行结果及分析:
(2)#include stdio.h
void main()
{
int a=100,b=20,sum,sb;
sum=a+b;
sb=a/b;
printf(sum=%d,sb=%d,sum,sb);
}
运行结果及分析:
(3)#include stdio.h
void main( )
{
char c1,c2;
c1=97;c2=98;
printf(%c ,%c\n,c1,c2);
printf(%d,%d\n,c1,
原创力文档

文档评论(0)