您的位置:首页 > 其它

第一次C程序设计上机报告

2013-03-20 13:11 274 查看
                  姓名:赵意    班级:电子信息工程一班    学号:120705117

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                                                  任务一

实验内容:编写一个“显示华氏度和摄氏度对照表”的C程序。

实验目的:掌握C语言开发工具,掌握简单C程序的编辑、编译、连接和运行的一般过程。

                                                         编程语言

<strong>//************************
//对fahr=0,20,...,300
//code by 赵意 120705117 2013-03-11
//************************
#include<stdio.h>
int main()
{
int fahr,celsius;
int lower,upper,step;

lower=0;   /*温度表的下限*/
upper=300; /*温度表的上限*/
step=20;   /*步长*/
fahr=lower;

printf("赵意 120705117\n", "");
while(fahr<=upper){
celsius=5*(fahr-32)/9;
printf("%d%d\n",fahr,celsius);
fahr=fahr+step;
}
return 0;
}
</strong>

                                                                                 运行程序:



                                                                             修改代码:

                            将printf("%d%d\n",fahr,celsius);改为printf("%d\t%d\n",fahr.celsius)

                                                                              运行程序:



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                            任务二

实验内容:运行作业“例6-3”程序。

实验目的:加深理解C程序的编辑、编译、连接和运行的一般过程。

                                                                       编辑语言:

//******************
//code by 赵意 120705117 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);
}

                                          

                                                                    运行程序:



                                                                   上机心得:

第一次编程,第一次博客,有过心酸也有过欢喜,不知我在这条路上能走多远?唯一路加油!

 

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  作业