📄 calc.cpp
字号:
#include<iostream>
#include"fraction.h"
void main(){
using namespace std;
fraction m,n;
int a=0;
int t=0;
cout<<"The program has fourarithmetic operations:"<<endl;
cout<<"Input 1 for add"<<endl;
cout<<"Input 2 for subtract"<<endl;
cout<<"Input 3 for multiply"<<endl;
cout<<"Input 4 for divide "<<endl;
do{
cout<<"Plese input the frist fraction's numerator!"<<endl;
cin>>m.num;
cout<<"Plese input the frist fraction's denominator!(0 to quit)"<<endl;
cin>>m.denom;
cout<<"Plese input the second fraction's numerator!(0 to quit)"<<endl;
cin>>n.num;
cout<<"Plese input the second fraction's denominator!(0 to quit)"<<endl;
cin>>n.denom;
cout<<"Plese input the operator!(0 to quit)"<<endl;
cin>>a;
switch(a){
case 1: show(add(m,n));
break;
case 2: show(subtract(m,n));
break;
case 3: show(multiply(m,n));
break;
case 4: show(divide(m,n));
break;
default:break;
}
cout<<"Would your like to begin?Input 0 to quit,input other to continue."<<endl;
cin>>t;
}while(t);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -