⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 insinfo.h

📁 simulation for computer selection
💻 H
字号:
#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 szspe=0,szspe1=0,szz=1,szres=1,szx=105,szy=120,szl=105,szr=150,szt=115,szb=135,szi,szcount=0;
 char sznum[5];
 int szcom[10];
int szn=0;
  void szca1(char ch);
  int  szconvertstr();
insinfo()
 {
 int gm=VGAHI,gd=VGA;

	initgraph(&gd,&gm,"c:\\tc\\bgi");
   cleardevice();
 settextstyle(TRIPLEX_FONT,HORIZ_DIR,3);
outtextxy(180,40,"INSTRUCTION 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 of instruction need to process the message ");
outtextxy(40,120,"--->");
fillellipse(25,160,3,3);
outtextxy(40,150,"Enter the number of instruction need to process the reply ");
outtextxy(40,170,"--->");
fillellipse(25,210,3,3);
outtextxy(40,200,"Enter the number of instruction need to interrupt the message");
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 szch;
szz=1;
for(;;)
{
szch=getch();
if(szch=='0'||szch=='1'||szch=='2'||szch=='3'||szch=='4'||szch=='5'||szch=='6'||szch=='7'||szch=='8'||szch=='9')
	{

	if(szcount<5)
	       {
	      sznum[szn]=szch;
		szn++;
	       szca1(szch);
	      szcount++;
		}
	}
	if(szch=='\b')
	{
	szx=105;szi=0;
	  moveto(szx,szy);
	   setfillstyle(1,BLACK);
	  bar(szl,szt,szr,szb);
	  szcount=0;szn=0;
	 }


	if((szch=='\r')&&(szn!=0))
	{
	 szx=105;
	 szi=0;
	 szy=szy+50;
	 szt=szt+50;
	 szb=szb+50;
	 szres++;
	 szcount=0;
	 szcom[szz]=szconvertstr();
	 szn=0;
	  szz++;
       //	 if(zres==4)
	// {
	// zspe++;
	// zspe1=zspe+10;
	 }else if(szres==4){break;}
}
  getch();
  closegraph();
  }


  void szca1(char sch)
  {

	   moveto(szx+szi,szy);
	       settextstyle(2,0,5);
	       setcolor(24);
	       switch(sch)
	       {
	       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;

	     }

	     szi=szi+8;
  }

    int  szconvertstr()
 {                   char szstr1[10];
  int szlen=strlen(sznum);
  for(int szfi=0;(szfi<szlen);szfi++)
  {  szstr1[szfi]=sznum[szfi];}
  szstr1[szfi]='\0';
  int sztemp=0;
 for(int szfx=0;szstr1[szfx]!='\0';szfx++)
 {
  switch(szstr1[szfx])
  {
   case '0':sztemp=sztemp*10;sztemp=sztemp+0;break;
   case '1':sztemp=sztemp*10;sztemp=sztemp+1;break;
   case '2':sztemp=sztemp*10;sztemp=sztemp+2;break;
   case '3':sztemp=sztemp*10;sztemp=sztemp+3;break;
   case '4':sztemp=sztemp*10;sztemp=sztemp+4;break;
   case '5':sztemp=sztemp*10;sztemp=sztemp+5;break;
   case '6':sztemp=sztemp*10;sztemp=sztemp+6;break;
   case '7':sztemp=sztemp*10;sztemp=sztemp+7;break;
   case '8':sztemp=sztemp*10;sztemp=sztemp+8;break;
   case '9':sztemp=sztemp*10;sztemp=sztemp+9;break;

   }
  }
  int szfinf;szfinf=0;
    szfinf=sztemp;
//   printf("the float value is %d",ztemp);
   sztemp=0;
   for(int szz1=0;szz1<szlen;szz1++)
   {
   sznum[szz1]='\0';
   }
 return szfinf;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -