📄 calcul.cpp
字号:
/* Calculator in C (Dos) Works With Mouse and so
Written by Tyrax !! Parsia_h@yahoo.com
Viva La Mercenaries */
#include <stdio.h>
#include <graphics.h>
#include <dos.h>
#include <stdlib.h>
#include <math.h>
REGS r;
unsigned int &a=r.x.ax;
unsigned int &b=r.x.bx;
unsigned int &c=r.x.cx;
unsigned int &d=r.x.dx;
#define de 300 // Delay Time
void main() {
// Function Prototypes
int bu();
void str(int *p,int co2,int key );
void cpy(int *p,int* q); // Copies Array p to Array q
void res(int *p); // Resets The Dynamic Array
void cl(); // Clears the Area where the Digits are Printed
void wri(double equ,int* po); // Writes the Data into the Screen
// Mathematical Functions
int dotd(int *p); // Returns the Dot position in the Array From 0 to 11 .. 12 if no Dot
double ar2di(int *y,int co2,int *po);
double fmul(int *y,int size_y,int *z,int size_z,int *po);
double fdiv(int *y,int size_y,int *z,int size_z,int *po);
double fadd(int *y,int size_y,int *z,int size_z,int *po);
double fsub(int *y,int size_y,int *z,int size_z,int *po);
double fsqr(int *y,int size_y,int *po);
double fexp(int *y,int size_y,int *z,int size_z,int *po);
int ma(int a,int b);
// Graphic Engine Started
int gdriver = DETECT, gmode=0;
initgraph(&gdriver,&gmode,"c:\\");
setcolor(1);
rectangle(150,30,450,400);
rectangle(200,90,400,120);
int i,j=150;
setfillstyle(1,8);
floodfill(160,190,1);
setcolor(2);
for (i=170;i<=270;i+=50) rectangle(i,j,i+30,j+30);
setfillstyle(1,2);
for (i=180;i<300;i+=50)
floodfill(i,170,2);
setcolor(4);
rectangle(350,200,380,230);
rectangle(400,200,430,230);
rectangle(350,150,430,180);
setfillstyle(1,4);
floodfill(400,170,4);
floodfill(370,220,4);
floodfill(420,220,4);
setcolor(BLUE);
rectangle(170,200,200,230);
rectangle(220,200,250,230);
rectangle(270,200,300,230);
for(j=250;j<=350;j+=50) {
for (i=170;i<=270;i+=50) rectangle(i,j,i+30,j+30);
for (i=350;i<=400;i+=50) rectangle(i,j,i+30,j+30); }
setfillstyle(1,1);
for ( i=220;i<380;i+=50)
for (int l=180;l<300;l+=50)
floodfill(l,i,1);
for ( i=270;i<380;i+=50)
for ( l=370;l<440;l+=50)
floodfill(l,i,1);
setcolor(15);
outtextxy(182,212,"7");
outtextxy(182,262,"4");
outtextxy(182,312,"1");
outtextxy(182,362,"0");
outtextxy(232,212,"8");
outtextxy(232,262,"5");
outtextxy(232,312,"2");
outtextxy(232,362,".");
outtextxy(282,212,"9");
outtextxy(282,262,"6");
outtextxy(282,312,"3");
outtextxy(273,362,"exp");
outtextxy(362,262,"*");
outtextxy(362,312,"+");
outtextxy(362,362,"=");
outtextxy(412,262,"/");
outtextxy(412,312,"-");
outtextxy(412,362,"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -