今天学习了数组,还有文件的一些东西。程序如下。
int i = 1;
int h = 0;
int wll[] = { 1,5,9,3,7 };
int zho[5];
int cgo[10] = { 2,4,9,68,110 };
int fd[100] = {};
while (i<101)
{
fd[i-1] = i;
h = fd[i-1]+h;
i++;
}
printf("%d\n",h);
//定义数组的方法
printf("%d\n", cgo[0]);
zho[3] = 11;
printf("%d\n",zho[2]);
printf("%d\n", zho[3]);
int main(int arc, const char * argv[])
{
int e = 0;
scanf_s("%d", &e);
int y = 0;
int s = 0;
int z[1000] = {};
int i = 0;
int ej = 0;
scanf_s("%d",&ej);
while (1)
{
y = e % ej;
s = e / ej;
e = s;
z[i] = y;
i++;
if (e == 0)
{
break;
}
}
while (i>0)
{
printf("%d",z[i-1]);
i--;
}
return 0;
}
回来任务
int main()
{
int k[7] = { 1,2,3,4,5,6,7 };
int z = 0;
int x = 0;
int j = 0;
int m = 0;
while (1){
while (1)
{
if (j>6)
{
j = j - 7;
}
if (k[j]!=0)
{
z++;
}
j++;
if (z==3)
{
z = 0;
break;
}
}
x++;
if (x==7)
{
m = k[j - 1];
break;
}
k[j - 1] = 0;
}
printf("%d",m);
return 0;
}
3天后回来!
总结,在程序执行中提取参数,直接定义赋值最简便。比如上面的m。