计算机

//#include<bits/stdc++.h>//<<fixed<<setprecision(2)
#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;//for(int i=1;i<=a;i++)
int main()
{
	long double a,f,g,h,i=1,j,u=0;
	char c,e;
	long long b=1,d;
	cout<<"这是计算机"<<endl<<"输入“5478278”,并快速按两次回车键即可退出此程序" <<endl<<"按“888”表示知道了"<<endl;
	cin>>j;
	if(j!=888)
	{
		while(j!=888)
		{
			if(j!=888)
			{
				cout<<"???"<<endl;
				cin>>j;
    		}
    		if(j==888)
			for(int i=1;i<=24;i++)
			cout<<endl;
		}
	}
	else
	for(int i=1;i<=24;i++)
	cout<<endl;
	cout<<"请输入密码:";
	cin>>a;
	if(a==1478278)
	{
		cout<<"需保留几位小数?"<<endl;
		cin>>h;
		while(h>100)
		{
			if(u!=4)
			{
		        cout<<"小数数位太多了!"<<endl<<"请再次输入:";
			}
			cin>>h;	
			u++;
			if(u==4)
			{
				cout<<"最多100位!"<<endl;
				u=0;
			} 
		}
		while(1)
		{
			cout<<"请输入算式:" ;
			cin>>b;
			if(b==5478278)
			break;
			cin>>c>>d>>e;
			if(c=='+')
			g=b+d;
			if(c=='-')
			g=b-d;
			if(c=='*')
			g=b*d;
			if(c=='/')
			g=float(b)/float(d);
			if(c=='%')
			g=b%d;
			cout<<fixed<<setprecision(h)<<g<<endl;
		}
	}
	else
	{
		while(a!=1478278)
		{
			cout<<"密码错误"<<endl<<"请再次输入密码:";
			cin>>a;
			if(a==5478278)
			break;
		}
		cout<<"需保留几位小数?"<<endl;
		cin>>h;
		while(h>100)
		{
			if(u!=4)
			{
		        cout<<"小数数位太多了!"<<endl<<"请再次输入:";
		    }
			cin>>h;	
			u++;
			if(u==4)
			{
				cout<<"最多100位!"<<endl;
				u=0;
			} 
		}
		while(1)
		{
			cout<<"请输入算式:" ;
			cin>>b;
			if(b==5478278)
			break;
			cin>>c>>d>>e;
			if(c=='+')
			g=b+d;
			if(c=='-')
			g=b-d;
			if(c=='*')
			g=b*d;
			if(c=='/')
			g=float(b)/float(d);
			if(c=='%')
			g=b%d;
			cout<<fixed<<setprecision(h)<<g<<endl;
		}
    }
    return 0;
}

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值