29-计算器
#include <iostream>
using namespace std;
int main()
{//x,y為操作數,c為運算符int x,y,z;char c1;cin>>x>>c1>>y; //c1//多路選擇語句選擇不同表達式計算語句switch(c1){case '+':cout<<x<<"+"<<y<<"="<<x+y<<endl;break;case '-':cout<<x<<"-"<<y<<"="<<x-y<<endl;break;case '*':cout<<x<<"*"<<y<<"="<<x*y<<endl;break;case '/':cout<<x<<"/"<<y<<"="<<x/y<<endl;break;case '%':cout<<x<<"%"<<y<<"="<<x%y<<endl;default:cout<<"Wrong!"<<endl;//當不符合上述情況時執行本句子}}
創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎
總結
- 上一篇: windows c++ 内存映射大文件问
- 下一篇: ssrf漏洞 php,DokuWiki