汪云峰 班级:电子信息工程一班 学号:120705116
---------------------------------------------------------华丽的分割线----------------------------------------------------
任务一:创建一个基本程序
实验内容:编写一个“显示华氏度和摄氏度对照表”的C程序。
实验目的:掌握C语言开发工具,掌握简单C程序的编辑、编译、连接和运行的一般过程。
编程语言:
//************************
//对fahr=0,20,...,300
//code by 汪云峰 120705116 2013-03-11
//************************
#include<stdio.h>
int main()
{
int fahr,celsius;
int lower,upper,step;
lower=0; /*温度表的下限*/
upper=300; /*温度表的上限*/
step=20; /*步长*/
fahr=lower;
printf("汪云峰 120705116\n", "");
while(fahr<=upper){
celsius=5*(fahr-32)/9;
printf("%d%d\n",fahr,celsius);
fahr=fahr+step;
}
return 0;
}
运行程序:
修改代码:
将printf(“%d%d\n”, fahr,Celsius);改为printf(“%d\t%d\n”,fahr,Celsius)
运行程序:
---------------------------------------------------再一次华丽现身----------------------------------------------------------
任务二:进一步熟悉C语言的程序编写的一般过程
实验内容:运行作业“例6-3”程序。
实验目的:加深理解C程序的编辑、编译、连接和运行的一般过程。
编辑语言:
//******************
//code by 汪云峰 120705116 2013-03-15
//******************
/*源程序:exp6_3.cpp*/
#include<stdio.h>
void main()
{
void swap(int x,int y);
int a,b;
a=2,b=6;
printf("调用前:a=%d,b=%d\n",a,b);
swap(a,b);
printf("调用后:a=%d,b=%d\n",a,b);
}
void swap(int x,int y)
{
int temp;
printf("交换前:x=%d,b=%d\n",x,y);
temp=x;
x=y;
y=temp;
printf("交换后:x=%d,y=%d\n",x,y);
}
运行程序:

-----------------------------------------------这是我最后一次现身----------------------------------------------------
上机心得:
第一次上机编程 虽然只是照抄上去 但是寻找错误的过程与程序成功运行的那一刻还是十分令人开心的!
tired but happy!