📄 sysinfo.cpp
字号:
#include<iostream.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>
#include<process.h>
#include<stdlib.h>
#include<stdio.h>
#include<string.h>
int zspe=0,zspe1=0,zcom[10],zz=0,zres=1,zx=105,zy=120,zl=105,zr=120,zt=115,zb=135,zi,zcount=0;
char znum[5];
int zn=0;
void zca1(char ch);
int zconvertstr();
void main()
{
int gm=VGAHI,gd=VGA;
initgraph(&gd,&gm,"c:\\tc\\bgi");
cleardevice();
settextstyle(TRIPLEX_FONT,HORIZ_DIR,3);
outtextxy(180,40,"SYSTEM INFORMATION");
line(173,70,425,70);
setcolor(LIGHTMAGENTA);
line(5,5,637,5);
line(5,5,5,470);
line(5,470,637,470);
line(10,10,630,10);
line(10,10,10,465);
line(10,465,630,465);
line(630,465,630,10);
line(637,470,637,5);
settextstyle(2,0,5);
setcolor(4);
fillellipse(25,110,3,3);
outtextxy(40,100,"Enter the number that are recived by system in one second (1-50)");
outtextxy(40,120,"--->");
fillellipse(25,160,3,3);
outtextxy(40,150,"Enter the size of the recived message in character (1-99)");
outtextxy(40,170,"--->");
fillellipse(25,210,3,3);
outtextxy(40,200,"Enter the percentage of the recived message that need to replay (1-99)");
outtextxy(40,220,"--->");
fillellipse(25,260,3,3);
outtextxy(40,250,"Enter the size of the sending message in character (1-99)");
outtextxy(40,270,"--->");
char zch;
for(;;)
{
zch=getch();
if(zch=='0'||zch=='1'||zch=='2'||zch=='3'||zch=='4'||zch=='5'||zch=='6'||zch=='7'||zch=='8'||zch=='9')
{
if(zcount<2+zspe)
{
znum[zn]=zch;
zn++;
zca1(zch);
zcount++;
}
}
if(zch=='\b')
{
zx=105;zi=0;
moveto(zx,zy);
setfillstyle(1,BLACK);
bar(zl,zt,zr+zspe1,zb);
zcount=0;zn=0;
}
if((zch=='\r')&&(zn!=0))
{
zx=105;
zi=0;
zy=zy+50;
zt=zt+50;
zb=zb+50;
zres++;
zcount=0;
zcom[zz]=zconvertstr();
zn=0;
zz++;
if(zres==4)
{
zspe++;
zspe1=zspe+10;
}else if(zres==5){break;}
}
}
getch();
}
void zca1(char ch)
{
moveto(zx+zi,zy);
settextstyle(2,0,5);
setcolor(24);
switch(ch)
{
case'0' : outtext("0");break;
case'1' : outtext("1");break;
case'2' : outtext("2");break;
case'3' : outtext("3");break;
case'4' : outtext("4");break;
case'5' : outtext("5");break;
case'6' : outtext("6");break;
case'7' : outtext("7");break;
case'8' : outtext("8");break;
case'9' : outtext("9");break;
}
zi=zi+8;
}
int zconvertstr()
{ char zstr1[10];
int zlen=strlen(znum);
for(int zfi=0;(zfi<zlen);zfi++)
{ zstr1[zfi]=znum[zfi];}
zstr1[zfi]='\0';
int ztemp=0;
for(int zfx=0;zstr1[zfx]!='\0';zfx++)
{
switch(zstr1[zfx])
{
case '0':ztemp=ztemp*10;ztemp=ztemp+0;break;
case '1':ztemp=ztemp*10;ztemp=ztemp+1;break;
case '2':ztemp=ztemp*10;ztemp=ztemp+2;break;
case '3':ztemp=ztemp*10;ztemp=ztemp+3;break;
case '4':ztemp=ztemp*10;ztemp=ztemp+4;break;
case '5':ztemp=ztemp*10;ztemp=ztemp+5;break;
case '6':ztemp=ztemp*10;ztemp=ztemp+6;break;
case '7':ztemp=ztemp*10;ztemp=ztemp+7;break;
case '8':ztemp=ztemp*10;ztemp=ztemp+8;break;
case '9':ztemp=ztemp*10;ztemp=ztemp+9;break;
}
}
int zfinf;zfinf=0;
zfinf=ztemp;
printf("the float value is %d",ztemp);
ztemp=0;
for(int zz1=0;zz1<zlen;zz1++)
{
znum[zz1]='\0';
}
return zfinf;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -