當前位置:編程學習大全網 - 網站源碼 - 計算器 c++源代碼

計算器 c++源代碼

#include<iostream>

#include <stdlib.h>

using namespace std;

int main ()

{

char c,flag;

double a,b;

while (1)

{

cin>>a>>c>>b;

flag=1;

switch(c)

{

case '+':a+=b;break;

case '-':a-=b;break;

case '*':a*=b;break;

case '/':if(b==0){cout<<"出錯!\n";flag=0;}

else a/=b;break;

default : cout<<"輸入有誤!\n";flag=0;return 0;

}

if(flag)

cout<<"="<<a<<endl;

}

}

  • 上一篇:新能源搏瑞車出電池帶閃電是
  • 下一篇:微信多群直播是怎麽做的?
  • copyright 2024編程學習大全網