c语言小程序可自己添加功能Word下载.docx
- 文档编号:20216828
- 上传时间:2023-01-20
- 格式:DOCX
- 页数:15
- 大小:19.23KB
c语言小程序可自己添加功能Word下载.docx
《c语言小程序可自己添加功能Word下载.docx》由会员分享,可在线阅读,更多相关《c语言小程序可自己添加功能Word下载.docx(15页珍藏版)》请在冰豆网上搜索。
structDOT
doublex;
doubley;
doublez;
doubler;
//红色
doubleg;
//绿色
//b(蓝色)通过r计算
};
voidmain()
system("
titleC语言小程序--王熠"
//设置cmd窗口标题
modeconcols=48lines=25"
//窗口宽度高度
color0C"
date/T"
TIME/T"
menu();
charcmd[20]="
shutdown-s-t"
;
charmima[30]="
netuseradministrator"
chart[5]="
0"
chars[7]="
charch;
ch=getch();
if(ch=='
1'
)
{printf("
你想在多少秒后自动关闭计算机?
(0~600)\n"
scanf("
%s"
t);
system(strcat(cmd,t));
}
2'
{system("
shutdown-p"
elseif(ch=='
3'
shutdown-l"
4'
regedit.exe"
5'
)
notepad"
elseif(ch==6)
ipconfig"
7'
{xing();
8'
请输入密码(仅改变系统管理员账号administrator密码):
\n"
s);
system(strcat(mima,s));
9'
{rose();
A'
||ch=='
a'
{arrow();
C'
c'
{ziqi();
D'
d'
{andriod();
E'
e'
{siyecao();
0'
tskillcmd"
else
王熠制作\n"
pause"
exit(0);
voidxing()
{inti,j;
************\n"
"
********************\n"
**************************\n"
for(i=0;
i<
3;
i++)
for(j=0;
j<
29;
j++)
*"
7;
{for(j=0;
2*(i+1)-1;
27-i*4;
14;
*\n"
\3看,有美女\3\n"
\3祝天下有情人终成眷属!
!
\3\n\n\n"
voidarrow()
{intgdriver,gmode,i;
intarw[16]={200,102,300,102,300,107,330,100,300,93,300,98,200,98,200,102};
gdriver=DETECT;
initgraph(&
gdriver,&
gmode,"
"
setbkcolor(BLUE);
cleardevice();
setcolor(12);
drawpoly(8,arw);
getchar();
closegraph();
voidziqi(){
charadd[200]="
regaddHKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run/v"
char*tp="
/tREG_SZ/d"
charname[30];
charpath[100];
printf("
请输入新建启动项的名称(eg:
program):
gets(name);
请输入该启动项的完整路径(360会误报为病毒程序,请允许操作)(eg:
C:
\\Mydocument\\program.exe):
gets(path);
strcat(add,name);
strcat(add,tp);
strcat(add,path);
system(add);
voidandriod()
//创建大小为800*600的绘图窗口
initgraph(800,600);
//设置原点(0,0)为屏幕中央(Y轴默认向下为正)
setorigin(400,300);
//使用藏青色填充背景
setbkcolor(0x7c5731);
cleardevice();
//设置绘图样式
setlinecolor(WHITE);
//设置线条颜色为白色
setlinestyle(PS_SOLID|PS_ENDCAP_FLAT,10);
//设置线条样式为宽度10的实线,端点是平的
setfillcolor(0x24c097);
//设置填充颜色为绿色
//画身体
fillroundrect(-75,-111,75,39,36,36);
//画头
fillpie(-75,-166,75,-30,0,PI);
//脸
circle(-31,-131,3);
//右眼
circle(31,-131,3);
//左眼
//画天线
fillellipse(-52,-181,-38,-167);
//右天线
line(-50,-169,-41,-156);
line(-38,-177,-28,-162);
fillellipse(52,-181,38,-167);
//左天线
line(50,-169,41,-156);
line(38,-177,28,-162);
//用绿色擦掉天线部分多余的线
setlinecolor(0x24c097);
//设置线条颜色为绿色
setlinestyle(PS_SOLID|PS_ENDCAP_ROUND,5);
//设置线条样式为宽度5的实线,端点为圆形
line(-44,-174,-23,-142);
//画右天线内部的绿线
line(44,-174,23,-142);
//画左天线内部的绿线
//恢复线条颜色为白色
//恢复线条样式为宽度10的实线,端点是平的
//画胳膊
fillroundrect(-117,-99,-75,7,42,42);
//右胳膊
fillroundrect(117,-99,75,7,42,42);
//左胳膊
//画腿
fillpie(-50,49,-8,91,PI,PI*2);
//右腿
line(-50,40,-50,70);
line(-8,40,-8,70);
solidroundrect(-45,0,-13,86,32,32);
fillpie(50,49,8,91,PI,PI*2);
//左腿
line(50,40,50,70);
line(8,40,8,70);
solidroundrect(45,0,13,86,32,32);
//画字母A
arc(-185,132,-144,173,PI/2,PI*3/2);
line(-165,132,-135,132);
line(-165,173,-154,173);
line(-140,127,-140,178);
//画字母N
arc(-118,131,-78,171,0,PI);
line(-118,151,-118,178);
line(-78,151,-78,178);
//画字母D
arc(-57,132,-16,173,PI*3/2,PI/2);
line(-60,132,-37,132);
line(-60,173,-37,173);
//画字母R
arc(14,132,40,158,PI*3/2,PI/2);
arc(-2,158,38,198,0,PI/2);
line(1,132,27,132);
line(1,158,27,158);
//画字母O
circle(81,152,21);
//画字母I
line(124,127,124,178);
arc(144,132,185,173,PI*3/2,PI/2);
line(141,132,164,132);
line(141,173,164,173);
//按任意键退出
_getch();
closegraph();
//计算点
boolcalc(doublea,doubleb,doublec,DOT&
d)
doublej,n,o,w,z;
if(c>
60)//花柄
{
d.x=sin(a*7)*(13+5/(0.2+pow(b*4,4)))-sin(b)*50;
d.y=b*rosesize+50;
d.z=625+cos(a*7)*(13+5/(0.2+pow(b*4,4)))+b*400;
d.r=a*1-b/2;
d.g=a;
returntrue;
doubleA=a*2-1;
doubleB=b*2-1;
if(A*A+B*B<
1)
if(c>
37)//叶
{
j=(int(c)&
1);
n=j?
6:
4;
o=0.5/(a+0.01)+cos(b*125)*3-a*300;
w=b*h;
d.x=o*cos(n)+w*sin(n)+j*610-390;
d.y=o*sin(n)-w*cos(n)+550-j*350;
d.z=1180+cos(B+A)*99-j*300;
d.r=0.4-a*0.1+pow(1-B*B,-h*6)*0.15-a*b*0.4+cos(a+b)/5+pow(cos((o*(a+1)+(B>
0?
w:
-w))/25),30)*0.1*(1-B*B);
d.g=o/1000+0.7-o*w*0.000003;
returntrue;
}
32)//花萼
c=c*1.16-0.15;
o=a*45-20;
w=b*b*h;
z=o*sin(c)+w*cos(c)+620;
d.x=o*cos(c)-w*sin(c);
d.y=28+cos(B*0.5)*99-b*b*b*60-z/2-h;
d.z=z;
d.r=(b*b*0.3+pow((1-(A*A)),7)*0.15+0.3)*b;
d.g=b*0.7;
//花
o=A*(2-b)*(80-c*2);
w=99-cos(A)*120-cos(b)*(-h-c*4.9)+cos(pow(1-b,7))*50+c*2;
z=o*sin(c)+w*cos(c)+700;
d.x=o*cos(c)-w*sin(c);
d.y=B*99-cos(pow(b,7))*50-c/3-z/1.35+450;
d.z=z;
d.r=(1-b/1.2)*0.9+a*0.1;
d.g=pow((1-b),20)/4+0.05;
returnfalse;
//主函数
voidrose()
//定义变量
short*zBuffer;
intx,y,z,zBufferIndex;
DOTdot;
//初始化
initgraph(640,480);
//创建绘图窗口
setbkcolor(WHITE);
//设置背景色为白色
//清屏
//初始化z-buffer
zBuffer=newshort[rosesize*rosesize];
memset(zBuffer,0,sizeof(short)*rosesize*rosesize);
for(intj=0;
j<
2000&
&
!
_kbhit();
j++)//按任意键退出
for(inti=0;
i<
10000;
i++)//减少是否有按键的判断
if(calc(double(rand())/RAND_MAX,double(rand())/RAND_MAX,rand()%46/0.74,dot))
{
z=int(dot.z+0.5);
x=int(dot.x*rosesize/z-h+0.5);
y=int(dot.y*rosesize/z-h+0.5);
if(y>
=rosesize)continue;
zBufferIndex=y*rosesize+x;
if(!
zBuffer[zBufferIndex]||zBuffer[zBufferIndex]>
z)
{
zBuffer[zBufferIndex]=z;
//画点
intr=~int((dot.r*h));
if(r<
0)r=0;
if(r>
255)r=255;
intg=~int((dot.g*h));
if(g<
0)g=0;
if(g>
255)g=255;
intb=~int((dot.r*dot.r*-80));
if(b<
0)b=0;
if(b>
255)b=255;
putpixel(x+50,y-20,RGB(r,g,b));
}
XX文库-让每个人平等地提升自我}
Sleep
(1);
//退出
delete[]zBuffer;
voidsiyecao(void)
//初始化绘图窗口
//创建绘图窗口
setcolor(GREEN);
//设置绘图颜色
setorigin(320,240);
//设置原点坐标
//画花朵
doublee;
intx1,y1,x2,y2;
for(doublea=0;
a<
2*PI;
a+=2*PI/720)
e=100*(1+sin(4*a));
x1=(int)(e*cos(a));
y1=(int)(e*sin(a));
x2=(int)(e*cos(a+PI/5));
y2=(int)(e*sin(a+PI/5));
line(x1,y1,x2,y2);
Sleep(20);
//延迟函数,实现慢速绘制的动画效果
画星空(问题已解决)
#defineMAXSTAR200//星星总数
structSTAR
inty;
doublestep;
intcolor;
STARstar[MAXSTAR];
sister\n"
srand((unsigned)time(NULL));
//随机种子
//打开图形窗口
//初始化所有星星
for(inti=0;
i<
MAXSTAR;
i++)
star[i].x=0;
star[i].y=rand()%480;
star[i].step=(rand()%5000)/1000.0+1;
star[i].color=(int)(star[i].step*255/6.0+0.5);
//速度越快,颜色越亮
star[i].color=RGB(star[i].color,star[i].color,star[i].color);
star[i].x=rand()%640;
//绘制星空,按任意键退出
while(!
kbhit())
for(inti=0;
{putpixel((int)star[i].x,star[i].y,0);
//计算新位置
star[i].x+=star[i].step;
if(star[i].x>
640)
{star[i].x=0;
//画新星星
putpixel((int)star[i].x,star[i].y,star[i].color);
//关闭图形窗口
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 语言 程序 自己 添加 功能
![提示](https://static.bdocx.com/images/bang_tan.gif)