#include <stdio.h>
#include <stdlib.h>
int MaxNum(int x, int y)
{
if (x>y)
return x;
else
return y;
}
int SumNum(int x, int y)
{
static int bbb = 0;
int c = 0;
c = x + y;
bbb = bbb + 1;
printf("第bbb=%d次计算加法\r\n", bbb);
return c;
}
void DelayNum(int x)
{
int i = 0;
for (i = 0; i<x; i++)
{
printf("i=%d\r\n", i);
}
}
void while00()
{
int i = 10;
while (i)
{
i = i - 1;
}
}
void Delay()
{
int i = 0;
for (i = 0; i<5; i++)
{
printf("i=%d\r\n", i);
}
}
void main(int argc, char *argv[])
{
int Snum = 0;
int Max = 0;
int x = 0;
int y = 0;
char c1 = 's';
char c2 = 'S';
Delay();
printf("**********\r\n");
DelayNum(8);
printf("**********\r\n");
Snum = SumNum(3, 5);
printf(" a and b is %d\r\n", Snum);
printf("**********\r\n");
Max = MaxNum(8, 2);
printf("The Max number is %d\r\n", Max);
printf("**********\r\n");
printf("Please input x,y\r\n");
scanf_s("%d,%d", &x, &y);
Snum = SumNum(x, y);
printf("The sum number of a and b is %d\r\n", Snum);
printf("**********\r\n");
printf("Please input x,y\r\n");
scanf_s("%d,%d", &x, &y);
Snum = SumNum(x, y);
printf("The sum number of a=%d and b=%d is %d\r\n",x,y,Snum);
printf("**********\r\n");
printf("c1=%c,c2=%c\r\n", c1, c2);
printf("c1=%d,c2=%d\r\n", c1, c2);
printf("c1=0x%x,c2=0x%x\r\n", c1, c2);
while00();
system("pause");
}
|