C语言入门样例,包含输入输出、函数调用。由于整个程序的注释是我写的,风格也是我的编程风格,所以归在原创类。 代码开始: /* * CREATE DATE: 20070926 * AUTHOR: Susu * PURPOSE: * My first C programme. * Input two integer number and output the max one. * LAST MODIFY DATE: 20071002 * */ /* TC 2.0 can ignore */ #include <stdio.h> /* declaration max function, TC 2.0 can ignore */ int max(int x, int y); /* main function */ int main() { int a,b,c; /* define variable */ scanf("%d%d",&a,&b); /* input,pay attention */ c=max(a,b); /* call max function */ printf("max=%d\n",c); /* output */ system("pause"); /* pause the programme */ return 0; /* return 0, terminate the programme */ } /* define max function */ int max(int x, int y) { int z; if(x>y) { z=x; } else { z=y; } return (z); }
|