复数计算器

用C++编写复数计算器的程序

#include<iostream>#include<string>using namespace std;class Complex{private: double m_real; double m_complex;public://各个函数的定义。 Complex(double real=0.0,double complex=0.0); void Setnumber(); Complex operator+(Complex &object); Complex operator-(Complex&); Complex operator*(Complex &); Complex operator/(Complex &); bool operator==(Complex &); void Display();};Complex::Complex(double real,double complex){ m_real=real; m_complex=complex;}void Complex::Setnumber()//定义设置函数。{ /*cout<<"input the real part of the number:"; cin>>m_real; cout<<"input the complex part of the number:"; cin>>m_complex;*/ string s; int i=1,flag=2,flag1=0; m_real=m_complex=0; cout<<"input the number:";//采用的输入字符串,根据字符串中的各个字符来判断实部和虚部。 cin>>s; while(i<=s.size()) { if(s[i-1]=="-"&&i==1) i++; if(s[i-1]<=57&&s[i-1]>=48) { (flag==2?m_real:m_complex)*=10; (flag==2?m_real:m_complex)+=s[i-1]-48; } else { if(s[i-1]=="i") flag=1; else flag=0; if(s[i-1]=="-") flag1=1; } i++; } //后面就是要判段是否要变号,因为要考虑的很多,所以分了情况进行实现。 if(m_real==0&&m_complex==0)//如果都为0,这是上面漏掉了-i和+i两种情况,在这里补上。 m_real=1; if(s[0]=="-")//如果实部是负数。 m_real*=-1; if(flag1==1)//如果复数的虚部是负数。 m_complex*=-1; if(flag==1&&flag1==0&&m_complex==0)//如果没有实部只有虚部。 { m_complex=m_real; m_real=0; }}//下面就是一些重载操作符的实现,相信你能够看懂!Complex Complex::operator +(Complex &object){ Complex temp; temp.m_real=this->m_real+object.m_real ; temp.m_complex=this->m_complex+object.m_complex; return temp;}Complex Complex::operator-(Complex &object){ Complex temp; temp.m_real=this->m_real +object.m_real ; temp.m_complex=this->m_complex +object.m_complex ; return temp;}Complex Complex::operator *(Complex &object){ Complex temp; temp.m_real=this->m_real *object.m_real -this->m_complex *object.m_complex ; temp.m_complex =this->m_complex*object.m_real +this->m_real *object.m_complex ; return temp;}Complex Complex::operator /(Complex &object){ Complex temp; temp.m_real =this->m_real *object.m_real +this->m_complex *object.m_complex ; temp.m_complex =this->m_complex*object.m_real -this->m_real *object.m_complex ; temp.m_real /=object.m_real *object.m_real +object.m_complex *object.m_complex ; temp.m_complex/=object.m_real *object.m_real +object.m_complex *object.m_complex ; return temp;}bool Complex::operator ==(Complex &object){ if(this->m_real==object.m_real &&this->m_complex ==object.m_complex ) return (cout<<" equal"<<endl,1); if(this->m_real<object.m_real ||this->m_complex <object.m_complex ) return (cout<<" the formal is less than the last!"<<endl,0); else return (cout<<"the formal is biger than the last!"<<endl,0);}void Complex::Display (){ m_real==0?cout<<" ":cout<<m_real; if(m_complex>0&&m_real) cout<<" + "; m_complex<=0?m_complex==0?cout<<" ":cout<<m_complex<<"i"<<endl:cout<<m_complex<<"i"<<endl;}int main(){ Complex object1,object2,object3,object4; object1.Setnumber (); object2.Setnumber(); object1.Display(); (object1+object2).Display ();//可以不用这样的方式调用函数,但是你可以自己实现一个重载输出流函数。 object1==object2;//判断。 (object1/object2).Display (); return 0;}你可以自己仔细看看!!
铁血嘟嘟2023-06-22 10:16:371

用C++编写一个复数计算器。为复数定义一个类,形式a+bi。a,b为double类型数字。

如果是为了作业的话,我建议你好好学!仅供参考!#include<iostream>using namespace std;class complex{ friend ostream& operator<<(ostream&,const complex&); friend istream& operator>>(istream&,complex&);private: double realpart,imagepart;public: complex(){}; complex operator+(complex); complex operator-(complex); complex operator*(complex); complex operator/(complex);};ostream& operator<<(ostream& cout,const complex& data){ cout<<data.realpart; cout.setf(ios::showpos);//虚部强制显示正负号 cout<<data.imagepart<<"i"; cout.unsetf(ios::showpos);//取消强制显示正负号 return cout;}istream& operator>>(istream& cin,complex& data){ char c,d; cin>>data.realpart>>c>>data.imagepart>>d; if(c=="-") data.imagepart=-data.imagepart; return cin;}complex complex::operator+(complex data){ complex a; a.realpart=realpart+data.realpart; a.imagepart=imagepart+data.imagepart; return a;}complex complex::operator*(complex data){ complex a; a.realpart=realpart*data.realpart; a.imagepart=imagepart*data.imagepart; return a;}complex complex::operator-(complex data){ complex a; a.realpart=realpart-data.realpart; a.imagepart=imagepart-data.imagepart; return a;}complex complex::operator/(complex data){ complex a; a.realpart=realpart/data.realpart; a.imagepart=imagepart/data.imagepart; return a;}int main(){ complex a,b; cin>>a; cin>>b; cout<<a+b<<endl; cout<<a-b<<endl; cout<<a*b<<endl; cout<<a/b<<endl; return 0;}
凡尘2023-06-17 01:44:402

求c++复数计算器1)所设计的复数计算器可以进行+ - * += -= *= ++ -- >= =

/* 递归算法实现带括号的计算器,程序已编译通过 *//*对四则混合运算所提取的形式化表达式(生成式)<exp> -> <term> { <addop> <term> }<addop> -> + | -<term> -> <factor> { <mulop> <factor> }<mulop> -> * | /<factor> -> ( <exp> ) | Number*/#include <stdio.h>#include <stdlib.h>#include <ctype.h>char token; /*全局标志变量*//*递归调用的函数原型*/int exp( void );int term( void );int factor( void );void error( void ) /*报告出错信息的函数*/{ fprintf( stderr, "错误 "); exit( 1 );}void match( char expectedToken ) /*对当前的标志进行匹配*/{ if( token == expectedToken ) token = getchar(); /*匹配成功,获取下一个标志*/ else error(); /*匹配不成功,报告错误*/}void Message(void){ printf("================================================================ "); printf("* 递归实现的四则运算表达式求值程序 * "); printf("**************************************************************** "); printf("使用方法:请从键盘上直接输入表达式,以回车键结束.如45*(12-2)[回车] "); printf("***************************************************************** ");}int main(){ int result; /*运算的结果*/ Message(); printf(" >> 请输入表达式: "); token = getchar(); /*载入第一个符号*/ result = exp(); /*进行计算*/ if( token == " " ) /* 是否一行结束 */ printf( " >> 表达式的计算结果为 : %d ", result ); else error(); /* 出现了例外的字符 */ system("pause"); return 0;}int exp( void ){ int temp = term(); /*计算比加减运算优先级别高的部分*/ while(( token == "+" ) || ( token == "-" )) switch( token ) { case "+": match("+"); /*加法*/ temp += term(); break; case "-": match("-"); temp -= term(); /*减法*/ break; } return temp;}int term( void ){ int div; /*除数*/ int temp = factor(); /*计算比乘除运算优先级别高的部分*/ while(( token == "*" ) || ( token == "/" )) switch( token ) { case "*": match("*"); /*乘法*/ temp *= factor(); break; case "/": match("/"); /*除法*/ div = factor(); if( div == 0 ) /*需要判断除数是否为0*/ { fprintf( stderr, "除数为0. " ); exit(1); } temp /= div; break; } return temp;}int factor( void ){ int temp; if( token == "(" ) /*带有括号的运算*/ { match( "(" ); temp = exp(); match(")"); } else if ( isdigit( token )) /*实际的数字*/ { ungetc( token, stdin ); /*将读入的字符退还给输入流*/ scanf( "%d", &temp ); /*读出数字*/ token = getchar(); /*读出当前的标志*/ } else error(); /*不是括号也不是数字*/ return temp;}
meira2023-06-17 01:44:402

求用JAVA编写的复数计算器代码

public class MyComplex { private double realpart; // 实部 private double imaginpart; // 虚部 public MyComplex ( double realpart, double imaginpart) {//有参构造 super(); setimaginpart(imaginpart); setrealpart(realpart); } public MyComplex () {//无参 super(); realpart=0; imaginpart=0; } public double getrealpart() { return realpart; } public void setrealpart(double real) { realpart = real; } public double getimaginpart() { return imaginpart; } public void setimaginpart(double imag) { imaginpart= imag; } public static MyComplex MyComplexAdd( MyComplex a, MyComplex b){//复数加法 a+b double n=a.imaginpart+b.imaginpart; double m=a.realpart+b.realpart; MyComplex result=new MyComplex (m,n); return result; } public static MyComplex MyComplexSub( MyComplex a, MyComplex b){//复数减法 a-b double m=a.realpart-b.realpart; double n=a.imaginpart-b.imaginpart; MyComplex result=new MyComplex (m,n); return result; } public static MyComplex MyCompleMul( MyComplex a, MyComplex b){//复数 乘法 a*b double m=(a.realpart*b.realpart)-(a.imaginpart*b.imaginpart); double n=(a.realpart*b.imaginpart)+(a.imaginpart*b.imaginpart); MyComplex result=new MyComplex (m,n); return result; } public static MyComplex MyCompleDiv( MyComplex a, MyComplex b){//复数除法 a/b double c=b.realpart*b.realpart+b.imaginpart*b.imaginpart; double n=(a.realpart*b.realpart)/c; double m=a.imaginpart*(-1)*(b.imaginpart)/c; MyComplex result=new MyComplex (m,n); return result; } public static void playMyComplex ( MyComplex c){//输出复数 System.out.println(c.realpart+"+"+c.imaginpart+"i"); } @Override public boolean equals(Object o){//重写Object 的equals(Object obj)判断两个复数是否相等 if(o==null){ return false; }else if(o instanceof MyComplex){ MyComplex myComplex=(MyComplex)o; if(myComplex.realpart==this.realpart&&myComplex.imaginpart==this.imaginpart){ return true; }else return false; } return false; } public static void main(String []args){ MyComplex a=new MyComplex(12,8); MyComplex b=new MyComplex(3,4); System.out.print("复数a: "); MyComplex.playMyComplex(a); System.out.print("复数b: "); MyComplex.playMyComplex(b); System.out.print("a+b:"); MyComplex result=MyComplex.MyComplexAdd(a, b); MyComplex.playMyComplex(result); System.out.print("a-b:"); result=MyComplex.MyComplexSub(a, b); MyComplex.playMyComplex(result); System.out.print("a*b:"); result=MyComplex.MyCompleMul(a, b); MyComplex.playMyComplex(result); System.out.print("a/b:"); result=MyComplex.MyCompleDiv(a, b); MyComplex.playMyComplex(result); a=new MyComplex(4,5); b=new MyComplex(4,5); System.out.print("复数a: "); MyComplex.playMyComplex(a); System.out.print("复数b: "); MyComplex.playMyComplex(b); System.out.println("a==b:"+(a==b)); System.out.println("a.equals(b):"+a.equals(b));} }运行结果:复数a: 12.0+8.0i复数b: 3.0+4.0ia+b:15.0+12.0ia-b:9.0+4.0ia*b:4.0+80.0ia/b:-1.28+1.44i复数a: 4.0+5.0i复数b: 4.0+5.0ia==b:falsea.equals(b):true
韦斯特兰2023-06-17 01:44:361

C++面向对象程序设计——复数计算器

哈哈,你可找对咯,我有。
Jm-R2023-06-17 01:44:321

用C++编写一个小型复数计算器

#include <stdlib.h>#include <math.h>#include <graphics.h>#include <stdio.h>#include <process.h>#define EXCAPE 27#define ENTER 13main(){ int press,i,x,y,x1,y1,ch_z=0; int dian=0; char ch="0"; /*input + - * / */ char emp[80],sum[80],*e,*s; double yuan=0.000000000000; void init(void); void clear_z(char *u); double strtoflt(char *p); int getkey(); int gd=DETECT, gm; initgraph(&gd, &gm, ""); e=emp; s=sum; init(); x = (getmaxx() / 2) - 120; y = (getmaxy() / 2) - 150; x1 = (getmaxx() / 2) + 120; y1 = (getmaxy() / 2) + 150; while(1){ press = getkey(); switch(press){ case EXCAPE: exit(0); case 47: bar (x + 10, y + 80 + 10, x + 60 - 10, y + 80 + 60 - 10); delay(8000); init(); if (ch!="0"){ switch(ch){ case "/": if (strtoflt(emp)==0.0){ ch="0"; ch_z=0; dian=0; emp[0]=""; sum[0]=""; e=emp; s=sum; outtextxy(x+30,y+40,"error!!!!!"); break; } yuan = strtoflt(sum) / strtoflt(emp); sprintf(sum,"%0.10f",yuan); clear_z(sum); outtextxy(x+30,y+40,sum); break; case "*": yuan = strtoflt(sum) * strtoflt(emp); sprintf(sum,"%0.10f",yuan); clear_z(sum); outtextxy(x+30,y+40,sum); break; case "+": yuan = strtoflt(sum) + strtoflt(emp); sprintf(sum,"%0.10f",yuan); clear_z(sum); outtextxy(x+30,y+40,sum); break; case "-": if (strtoflt(sum)>=strtoflt(emp)){ yuan = strtoflt(sum) - strtoflt(emp); sprintf(sum,"%0.10f",yuan); } else{ yuan=strtoflt(emp)-strtoflt(sum); sprintf(sum,"-%0.10f",yuan); } clear_z(sum); outtextxy(x+30,y+40,sum); emp[0]=""; } } else{ if (ch_z==0){ outtextxy(x+30,y+40,emp); stpcpy(sum,emp); } else{ outtextxy(x+30,y+40,sum); } } ch="/"; ch_z=0; emp[0]=""; e=emp; dian=0; break; case 42: bar (x + 60 + 10, y + 80 + 10, x + 60 * 2 - 10, y + 80 + 60 - 10); delay(8000); init(); if (ch!="0"){ switch(ch){ case "/": yuan = strtoflt(sum) / strtoflt(emp); sprintf(sum,"%0.10f",yuan); clear_z(sum); outtextxy(x+30,y+40,sum); emp[0]=""; e=emp; break; case "*": yuan = strtoflt(sum) * strtoflt(emp); sprintf(sum,"%0.10f",yuan); clear_z(sum); outtextxy(x+30,y+40,sum); emp[0]=""; e=emp; break; case "+": yuan = strtoflt(sum) + strtoflt(emp); sprintf(sum,"%0.10f",yuan); clear_z(sum); outtextxy(x+30,y+40,sum); emp[0]=""; e=emp; break; case "-": if (strtoflt(sum)>=strtoflt(emp)){ yuan = strtoflt(sum) - strtoflt(emp); sprintf(sum,"%0.10f",yuan); } else{ yuan=strtoflt(emp)-strtoflt(sum); sprintf(sum,"-%0.10f",yuan); } clear_z(sum); outtextxy(x+30,y+40,sum); emp[0]=""; e=emp; break; } } else{ if (ch_z==0){ outtextxy(x+30,y+40,emp); stpcpy(sum,emp); e=emp; } else outtextxy(x+30,y+40,sum); } ch="*"; ch_z=0; dian=0; break; case 45: bar (x + 60 * 2 + 10, y + 80 + 10, x + 60 * 3 - 10, y + 80 + 60 - 10); delay(8000); init(); if (ch!="0"){ switch(ch){ case "/": yuan = strtoflt(sum) / strtoflt(emp); sprintf(sum,"%0.10f",yuan); clear_z(sum); outtextxy(x+30,y+40,sum); emp[0]=""; e=emp; break; case "*": yuan = strtoflt(sum) * strtoflt(emp); sprintf(sum,"%0.10f",yuan); clear_z(sum); outtextxy(x+30,y+40,sum); emp[0]=""; e=emp; break; case "+": yuan = strtoflt(sum) + strtoflt(emp); sprintf(sum,"%0.10f",yuan); clear_z(sum); outtextxy(x+30,y+40,sum); emp[0]=""; e=emp; break; case "-": if (strtoflt(sum)>=strtoflt(emp)){ yuan = strtoflt(sum) - strtoflt(emp); sprintf(sum,"%0.10f",yuan); } else{ yuan=strtoflt(emp)-strtoflt(sum); sprintf(sum,"-%0.10f",yuan); } clear_z(sum); outtextxy(x+30,y+40,sum); emp[0]=""; e=emp; break; } } else{ if (ch_z==0){ outtextxy(x+30,y+40,emp); stpcpy(sum,emp); e=emp; } else outtextxy(x+30,y+40,sum); } ch="-"; ch_z=0; dian=0; break; case 43: bar (x + 60 * 3 + 10, y + 80 + 10, x + 60 * 4 - 10, y + 80 + 60 - 10); delay(8000); init(); if (ch!="0"){ switch(ch){ case "/": yuan = strtoflt(sum) / strtoflt(emp); sprintf(sum,"%0.10f",yuan); clear_z(sum); outtextxy(x+30,y+40,sum); emp[0]=""; e=emp; break; case "*": yuan = strtoflt(sum) * strtoflt(emp); sprintf(sum,"%0.10f",yuan); clear_z(sum); outtextxy(x+30,y+40,sum); emp[0]=""; e=emp; break; case "+": yuan = strtoflt(sum) + strtoflt(emp); sprintf(sum,"%0.10f",yuan); clear_z(sum); outtextxy(x+30,y+40,sum); emp[0]=""; e=emp; break; case "-": if (strtoflt(sum)>=strtoflt(emp)){ yuan = strtoflt(sum) - strtoflt(emp); sprintf(sum,"%0.10f",yuan); } else{ yuan=strtoflt(emp)-strtoflt(sum); sprintf(sum,"-%0.10f",yuan); } clear_z(sum); outtextxy(x+30,y+40,sum); emp[0]=""; e=emp; break; } } else{ if (ch_z==0){ outtextxy(x+30,y+40,emp); stpcpy(sum,emp); e=emp; } else outtextxy(x+30,y+40,sum); } ch="+"; ch_z=0; dian=0; break; case 49: bar (x + 10, y + 80 + 53 + 10, x + 60 - 10, y + 80 + 53 * 2 - 4); delay(8000); init(); for (i=0;i<=79;i++){ if (emp[i]=="") break; } if (ch_z==0){ *e="1";e++;*e=""; outtextxy(x+30,y+40,emp); } else{ outtextxy(x+30,y+40,sum); } break; case 50: bar (x + 60 + 10, y + 80 + 53 + 10, x + 60 * 2 - 10, y + 80 + 53 * 2 - 4); delay(8000); init(); for (i=0;i<=79;i++){ if (emp[i]=="") break; } if (ch_z==0){ *e="2";e++;*e=""; outtextxy(x+30,y+40,emp); } else{ outtextxy(x+30,y+40,sum); } break; case 51: bar (x + 60 * 2 + 10, y + 80 + 53 + 10, x + 60 * 3 - 10, y + 80 + 53 * 2 - 4); delay(8000); init(); for (i=0;i<=79;i++){ if (emp[i]=="") break; } if (ch_z==0){ *e="3";e++;*e=""; outtextxy(x+30,y+40,emp); } else{ outtextxy(x+30,y+40,sum); } break; case ENTER: bar (x + 60 * 3 + 10, y + 80 + 53 + 10, x + 60 * 4 - 10, y + 80 + 53 * 2 - 4); delay(8000); init(); if (ch!="0"){ switch(ch){ case "/": yuan = strtoflt(sum) / strtoflt(emp); sprintf(sum,"%0.10f",yuan); clear_z(sum); outtextxy(x+30,y+40,sum); emp[0]=""; e=emp; break; case "*": yuan = strtoflt(sum) * strtoflt(emp); sprintf(sum,"%0.10f",yuan); clear_z(sum); outtextxy(x+30,y+40,sum); emp[0]=""; e=emp; break; case "+": yuan = strtoflt(sum) + strtoflt(emp); sprintf(sum,"%0.10f",yuan); clear_z(sum); outtextxy(x+30,y+40,sum); emp[0]=""; e=emp; break; case "-": if (strtoflt(sum)>=strtoflt(emp)){ yuan = strtoflt(sum) - strtoflt(emp); sprintf(sum,"%0.10f",yuan); } else{ yuan=strtoflt(emp)-strtoflt(sum); sprintf(sum,"-%0.10f",yuan); } clear_z(sum); outtextxy(x+30,y+40,sum); emp[0]=""; e=emp; break; } } else{ if (ch_z==0){ outtextxy(x+30,y+40,emp); stpcpy(sum,emp); e=emp; } else{ outtextxy(x+30,y+40,sum); } } ch="0"; ch_z=1; dian=0; break; case 52: bar (x + 10, y + 80 + 53 * 2 + 10, x + 60 - 10, y + 80 + 53 * 3 - 4); delay(8000); init(); if (ch_z==0){ *e="4";e++;*e=""; outtextxy(x+30,y+40,emp); } else{ outtextxy(x+30,y+40,sum); } break; case 53: bar (x + 60 + 10, y + 80 + 53 * 2 + 10, x + 60 * 2 - 10, y + 80 + 53 * 3 - 4); delay(8000); init(); if (ch_z==0){ *e="5";e++;*e=""; outtextxy(x+30,y+40,emp); } else{ outtextxy(x+30,y+40,sum); } break; case 54: bar (x + 60 * 2 +10, y + 80 + 53 * 2 + 10, x + 60 * 3 - 10, y + 80 + 53 * 3 - 4); delay(8000); init(); if (ch_z==0){ *e="6";e++;*e=""; outtextxy(x+30,y+40,emp); } else{ outtextxy(x+30,y+40,sum); } break; case 46: bar (x + 60 * 3 + 10, y + 80 + 53 * 2 + 10, x + 60 * 4 - 10, y + 80 + 53 * 3 - 4); delay(8000); init(); if (dian==0){ if (ch_z==0){ *e=".";e++;*e=""; outtextxy(x+30,y+40,emp); } else{ outtextxy(x+30,y+40,sum); } } else{ if (ch_z==0) outtextxy(x+30,y+40,emp); else outtextxy(x+30,y+40,sum); } dian=1; break; case 55: bar (x + 10, y + 80 + 53 * 3 + 10, x + 60 - 10, y + 80 + 53 * 4 - 4); delay(8000); init(); if (ch_z==0){ *e="7";e++;*e=""; outtextxy(x+30,y+40,emp); } else{ outtextxy(x+30,y+40,sum); } break; case 56: bar (x + 60 + 10, y + 80 + 53 * 3 + 10, x + 60 * 2 -10, y + 80 + 53 * 4 - 4); delay(8000); init(); if (ch_z==0){ *e="8";e++;*e=""; outtextxy(x+30,y+40,emp); } else{ outtextxy(x+30,y+40,sum); } break; case 57: bar (x + 60 * 2 + 10, y + 80 + 53 * 3 + 10, x + 60 * 3 - 10, y + 80 + 53 * 4 - 4); delay(8000); init(); if (ch_z==0){ *e="9";e++;*e=""; outtextxy(x+30,y+40,emp); } else{ outtextxy(x+30,y+40,sum); } break; case 48: bar (x + 60 * 3 + 10, y + 80 + 53 * 3 + 10, x + 60 * 4 - 10, y + 80 + 53 * 4 - 4); delay(8000); init(); if (ch_z==0){ *e="0";e++;*e=""; outtextxy(x+30,y+40,emp); } else{ outtextxy(x+30,y+40,sum); } break; case 32: emp[0]=""; sum[0]=""; e=emp; s=sum; ch="0"; ch_z=0; dian=0; init(); break; case 8: delay(8000); for(i=0;i<=79;i++){ if (emp[i]=="") break; } if (i==0) break; if (i!=79&&i!=0){ i--; emp[i]=""; e=&emp[i]; } init(); outtextxy(x+30,y+40,emp); break; } }}/*---------------------------------------------------------------------*/void init(void){ int x, y, x1, y1, i, j; char emp; x = (getmaxx() / 2) - 120; y = (getmaxy() / 2) - 150; x1 = (getmaxx() / 2) + 120; y1 = (getmaxy() / 2) + 150; cleardevice(); setbkcolor(3); setfillstyle(1, 15); setcolor(15); settextstyle(1,0,1); rectangle (x, y, x1, y1); rectangle (x - 7, y - 7, x1 + 7, y1 + 7); rectangle (x + 10, y + 10, x1 - 10, y + 80 - 10); line (x, y + 80, x1, y + 80); y = y + 80; for (j = 1; j <= 4; j++){ x = (getmaxx() / 2) - 120; for (i = 1; i <= 4; i++){ /* bar (x + 10, y + 10, x + 60 - 10, y + 60 - 10);*/ rectangle(x + 10, y + 10, x + 60 - 10, y + 60 - 10); if (j == 1){ if (i == 1) outtextxy(x + 20, y + 20, "/"); if (i == 2) outtextxy(x + 25, y + 20, "*"); if (i == 3) outtextxy(x + 27, y + 20, "-"); if (i == 4) outtextxy(x + 25, y + 20, "+"); } if (j == 2){ if (i == 1) outtextxy(x + 25, y + 20, "1"); if (i == 2) outtextxy(x + 25, y + 20, "2"); if (i == 3) outtextxy(x + 25, y + 20, "3"); if (i == 4) outtextxy(x + 25, y + 20, "="); } if (j == 3){ if (i == 1) outtextxy(x + 25, y + 20, "4"); if (i == 2) outtextxy(x + 25, y + 20, "5"); if (i == 3) outtextxy(x + 25, y + 20, "6"); if (i == 4) outtextxy(x + 25, y + 20, "."); } if (j == 4){ if (i == 1) outtextxy(x + 25, y + 20, "7"); if (i == 2) outtextxy(x + 25, y
真颛2023-06-17 01:44:132