1:
编译通不过;意思可能输出hello
3;
/*
* file:max-arrey.c
* ----------------
* This program is looked for the
* max number in 16 numbers and print the
* the max and the row.
* --------------------------------------
*/
#include
void main()
{
int a[16];
int i;
int row;
int max;
printf("please input 16 numbers:\n");
for (i=0;i<16;i++)
{
scanf("%d",&a[i]);
}
max=a[0];
for (i=0;i<16;i++)
{
if (a[i]>max)
{
max=a[i];
row=i;
}
}
printf("max=%d,row=%d\n",max,row);
getch();
}
3:
/*
* file:add.c
* ==========
* This program is used to
* add three numbers from
* using function print the
* result
*/
#include
void main()
{
int add(int * p1,int *p2,int *p3);
int a,b,c;
int * q1,* q2,*q3;
printf("The program is used to add three numbers:\n");
scanf("%d,%d,%d",&a,&b,&c);
q1=&a;q2=&b;q3=&c;
add(q1,q2,q3);
printf("the result is %d\n",add(q1,q2,q3));
getch();
}
int add(int * p1,int *p2,int *p3)
{
int z;
z=* p1 + * p2 + *p3;
return();
}
5;
struct stuff
{
int num;
char addr[30];
char sex;
int age;
int worktime;
int wage;
}
6:
/*
* file: add-arrey.c
* -----------------
* The program is used to add the arrey 对角线元素之和
* print the result
* ---------------------------------------------------
*/
#include
void main()
{
int i,j;
int t=0,tn=0;
int a[5][5];
int sum;
printf("entry a arrey:\n");
for (i=0;i<5;i++)
{
for (j=0;j<5;j++)
{
scanf("%d",&a[i][j]);
}
}
for (i=0;i<5;i++)
{
for (j=0;j<5;j++)
{
if (i==j)
{
t=t+a[i][j];
}
if (i+j==6)
{
tn=tn+a[i][j];
}
sum=t+tn+a[2][2];
}
}
printf("the result is %d\n",sum);
getch();
}
◆◆
评论读取中....
请登录后再发表评论!
◆◆
修改失败,请稍后尝试