//***********************
// 对 fahr=0,20,...,300
// 打印华氏温度与摄氏温度对照表
// Code by 汪超亚 12070522424 2013-03-11
//***********************
#include<stdio.h>
int main()
{
int fahr,celsius;
int lower,upper,step;
lower=0; /*温度表的下限*/
upper=300; /*温度表的上限*/
step =20; /*步长*/
fahr=lower;
printf("汪超亚,24\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)
修改代码后,程序运行截图:
修改前后运行效果说明:
在加入“\t”之后,数据之间有间隙,更美观有条理。
#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);
}
打的我火大 饿死我了 我去吃饭了 不过打完的成就还是很可以的,最坑的是打的虽然是英文,但是看不懂的好多
知识点总结:
一个程序至少有一个函数,main函数常称为主函数;函数中所有语句都包括在一对花括号中。