主题:help~~~~~~
write down the output result of the program below.
#include<stdio.h>
void print_func(int*s,int x,int y,int w,int h,int fetch)
{
int i,j remainder;
if(fetch>w)
return;
else
remainder = w - fetch;
s+=(y*w+x);
for(i=0;i<h;i++){
for(j=0;j<fetch;j++)
printf("%d",*s++);
s += remainder;
printf("\n");
}
}
void main()
{
int s[100],i;
for(i=1;i<=100;i++)
s[i-1]=i;
print_func(s,2,2,10,2,5);
}
Result:
Fill C code to accomplish below function
/*Function"YangHui"is used to construct a YangHui triangle
*1
*1 1
*1 2 1
*1 3 3 1
*1 4 6 4 1
*1 5 10 10 5 1
*.............
*/
void YangHui(int a[][YANGHUIMAX])
{
int i,j;
for (i=0;i<YANGHUIMAX;i++)
{
a[i][0]=1;
_______=1;
}
for(_________;i<YANGHUIMAX;i++)
for(j=1;___________;j++)
a[i][j]=____________+a[i-1][j];
}
#include<stdio.h>
void print_func(int*s,int x,int y,int w,int h,int fetch)
{
int i,j remainder;
if(fetch>w)
return;
else
remainder = w - fetch;
s+=(y*w+x);
for(i=0;i<h;i++){
for(j=0;j<fetch;j++)
printf("%d",*s++);
s += remainder;
printf("\n");
}
}
void main()
{
int s[100],i;
for(i=1;i<=100;i++)
s[i-1]=i;
print_func(s,2,2,10,2,5);
}
Result:
Fill C code to accomplish below function
/*Function"YangHui"is used to construct a YangHui triangle
*1
*1 1
*1 2 1
*1 3 3 1
*1 4 6 4 1
*1 5 10 10 5 1
*.............
*/
void YangHui(int a[][YANGHUIMAX])
{
int i,j;
for (i=0;i<YANGHUIMAX;i++)
{
a[i][0]=1;
_______=1;
}
for(_________;i<YANGHUIMAX;i++)
for(j=1;___________;j++)
a[i][j]=____________+a[i-1][j];
}