无论什么样的编程语言,第一步当然是打出hello world啦!
#include <stdio.h>
int main()
{
printf("hello world!\n");
getchar();
return 0;
}
当然也可以用你好来代替:
# include <stdio.h>
int main()
{
printf("你好\n");
return 0 ;
}
其次c语言作为智能的代表,一些简单的计算自然不在话下:
#include <stdio.h>
int main()
{
printf("23+43=%d\n",23+43);
return 0;
}
最后c语言还可以进行交互
#include <stdio.h>
int main()
{
int price
= 0;
printf("请输入的金额(元):");
scanf("%d",&price
);
int change
= 100 - price
;
printf("找您%d元。\n",change
);
return 0;
}