C语言题目求助,请问图中打红圈的代码AS=什么啊?
C语言程序设计题{会绕圈的数}求解答,要完整代码
//我是有多闲,完整给你写出来了,简单注释
#include<stdio.h>
void CoreFun(int n); //核心算法
int main()
{
int num[100]; //保存用户输入
int i;
for(i=0;;i++) //直到用户输入0退出for循环
{
scanf("%d",&num[i]);
if(num[i]==0)
break;
}
for(i=0;num[i]!=0;i++) //循环进行计算
{
CoreFun(num[i]);
}
return 0;
}
void CoreFun(int n)
{
int sum = 0;
int result[100];
int i = 0;
int temp = n;
int j;
printf("%d ",n);
while(1)
{
while(temp>0)
{
int t = temp%10;
t = t*t;
sum += t;
temp/=10;
}
result[i++] = sum;
for(j=0;j<i-1;j++)
if(sum==result[j])
{
printf("%d\n",sum);
return;
}
temp = sum;
printf("%d ",sum);
sum = 0;
}
}
C语言题目,最好要有代码,谢谢各位大虾!
int a[8]={1,23,34,54,65,75,86,3};//十个人
int b[8];//退出来的编号
int j,i;
for(i=8;i<0;i--){
b[8-i]=a[i];
printf("b[%d]=%d",8-i,a[8-i]);
}
C语言:图中划红线的什么意思啊>>??
int j=0;
int i=770;
a[j++]=i;//等价于a[0]=770,然后j变成1
*n=j;//将指针n指向的内存值改成1
求C语言题目解答(闪动的多彩圆)
#include <stdio.h>
#include <stdlib.h>
#include <graphics.h>
struct tagColorName
{
int iColor;
char szName[16];
} ColorName;
struct tagColorName stColorTbl[] =
{
{BLACK, "black"},
{BLUE, "blue"},
{GREEN, "green"},
{CYAN, "cyan"},
{RED, "red"},
{MAGENTA, "magenta"},
{BROWN, "brown"},
{LIGHTGRAY, "lightgray"},
{DARKGRAY, "darkgray"},
{LIGHTBLUE, "lightblue"},
{LIGHTGREEN, "lightgreen"},
{LIGHTCYAN, "lightcyan"},
{LIGHTRED, "lightred"},
{LIGHTMAGENTA, "lightmagenta"},
{YELLOW, "yellow"},
{WHITE, "white"},
};
int iRadiusTbl[] =
{
5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75
};
void main()
{
unsigned int i = 0, j = 15;
/*初始化图形模式,下面的两行代码是必须的*/
int gdriver = DETECT, gmode;
initgraph(&gdriver, &gmode, "");
while (!kbhit())
{
/*擦屏幕*/
cleardevice();
/*设置背景颜色*/
setbkcolor(stColorTbl[i].iColor);
/*设置画笔颜色*/
setcolor(stColorTbl[j].iColor);
/* 输出颜色名称 */
outtextxy(200, 100, stColorTbl[i].szName);
/* 绘制圆形 */
circle(100, 100, iRadiusTbl[i]);
/* 延时一秒 */
sleep(1);
i = ++i % 16;
j = --j % 16;
}
/*关闭图形模式,代码是必须的*/
closegraph();
}