第一次上机任务

//******************************
//对fahr=0,20,…,300
//打印华氏温度与摄氏温度对照表
//Code by 吴睿恒 01 2013/3/8
//******************************
#include<stdio.h>
int main()
{
     int fahr,celsius;
	 int lower,upper,step;

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

	 printf("吴睿恒,01\n", "");
	 while(fahr<=upper){
		  celsius=5 * (fahr-32)/9;
		  printf("%d   %d\n", fahr,celsius);
		  fahr=fahr+step;
	 }
	 return 0;
}


 

//*********
//函数间的参数值单向传递方式
//Cody by 吴睿恒 01 2012-3-8
//*****
/*源程序: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,y=%d\n",x,y);
	temp=x;
	x=y;
	y=temp;
	printf("交换后;x=%d,y=%d\n",x,y);


 

 

总结:编写程序老忘记分号,空不空格空多少格不知是否对程序有影响。开头的 #include <stdio.h>是不变的。tired but fun

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值