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

📄 commain.cpp

📁 simulation for computer selection
💻 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>
//#include"c:\tc\bin\sysinfo.h"
//#include"c:\tc\bin\cominfo.h"
//#include"c:\tc\bin\bufinfo.h"
#include"c:\tc\bin\combufin.h"
int spe=0,spe1=0,com[10],z=0,res=1,x=105,y=120,l=105,r=120,t=115,b=135,i,count=0;
 char num[5],c;
int n=0;
  void ca1(char ch);
  int  convertstr();
void main()
 {
 int gm=VGAHI,gd=VGA;

	initgraph(&gd,&gm,"c:\\tc\\bgi");

      cleardevice();
 settextstyle(TRIPLEX_FONT,HORIZ_DIR,3);
outtextxy(110,40,"COMPUTER SELECTION SIMULATION");
 line(105,70,500,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,"Press 1 to Input new set of data");

fillellipse(25,160,3,3);
outtextxy(40,150,"Press 2 to view the Computer and Buffer you have entered");

fillellipse(25,210,3,3);
outtextxy(40,200,"Press 3 to Output the Best Computer Combination");

fillellipse(25,260,3,3);
outtextxy(40,250,"Press 4 to view the Graph");
outtextxy(80,350,"Enter your Choice....");


   char ch;
for(;;)
{
ch=getch();
if(ch=='0'||ch=='1'||ch=='2'||ch=='3'||ch=='4'||ch=='5'||ch=='6'||ch=='7'||ch=='8'||ch=='9')
	{
	 if(ch!='\r')
	 {c=ch;}
	 ca1(ch);
	 }
		if((ch=='\r')){break;}

   }

    switch(c)
	       {

	       case'1' :
	       sysinfo();cominfo();bufinfo();break;
	       case'2' :combufin();break;
	    //   case'3' :setfillstyle(1,BLACK);bar(300,340,350,380); outtext("3");break;
	     //  case'4' :setfillstyle(1,BLACK);bar(300,340,350,380); outtext("4");break;
	       case'5' :exit(0);break;


	     }
	     cleardevice();
	     for(int i=0;i<xk;i++)
 {
  printf("\nthe %d computer is %f",i,xcomi[i]);
  printf("\nthe %d computer cost is %f",i,xcomc[i]);
 }

  for(i=0;i<ck;i++)
 {
  printf("\nthe %d buffer is %f",i,ccomi[i]);
  printf("\nthe %d buffer cost is %f",i,ccomc[i]);
 }




 }


  void ca1(char ch)
  {

	   moveto(300,350);
	       settextstyle(2,0,5);
	       setcolor(24);
	       switch(ch)
	       {

	       case'1' :setfillstyle(1,BLACK);  bar(300,340,350,380); outtext("1");break;
	       case'2' :setfillstyle(1,BLACK); bar(300,340,350,380); outtext("2");break;
	       case'3' :setfillstyle(1,BLACK);bar(300,340,350,380); outtext("3");break;
	       case'4' :setfillstyle(1,BLACK);bar(300,340,350,380); outtext("4");break;
	       case'5' :setfillstyle(1,BLACK);bar(300,340,350,380); outtext("5");break;


	     }


  }

⌨️ 快捷键说明

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