/*源程序:exp5_7.cpp*/
#include<stdio.h>
void main()
{ int n,i=0;
for(n=100;n<=150;n++)
{if(n%3==0)
continue;
printf("%d",n);
i++;
if(i%10==0)
printf("\n");
}
printf("\n");
}
/*源程序:exp5_10.cpp*/
#include<stdio.h>
void main()
{ int i,j;
int sum1,sum2=0;
for(i=1;i<=5;i++)
{sum1=1;
for(j=1;j<=1;j++)
sum1=sum1*j;
sum2=sum2+sum1;
}
printf("1!+2!+3!+4!+5!=%d\n",sum2);
}
/*源程序:exp6_2.cpp*/
#include<stdio.h>
void main()
{
void printfline();
int max(int a,int b);
int x,y,z,d;
printfline();
printf("input there number:\n");
scanf("%d%d%d",&x,&y,&z);
d=max(x,y);
d=max(d,z);
printf("maxmaum=%d\n",d);
}
void printfline()
{
printf("there is a C program!\n");
}
int max(int a,int b)
{
if(a>b)return a;
else return b;
}
/*源程序: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);
}