Skip to content

Instantly share code, notes, and snippets.

@MohamedRamadanSaad
Last active August 29, 2015 14:22
Show Gist options
  • Save MohamedRamadanSaad/2e08dae42a0a1f3f15fe to your computer and use it in GitHub Desktop.
Save MohamedRamadanSaad/2e08dae42a0a1f3f15fe to your computer and use it in GitHub Desktop.
C++ , calculation by do while , switch
#include <iostream>
using namespace std;
int main()
{
cout<<"********************************************************************************\n";
cout<<"**** Designed By: Mohamed Ramadan The Caculation *****\n";
cout<<"********************************************************************************\n";
int x[2];
char y;
int d=1;
do{
if(x[1]==0)
return 0;
cout<<"Enter The Operation ::";
cout<<endl;
cin>>x[1];
if(x[1]==0)
break;
cin>>y;
cin>>x[2];
switch(y){
case('+'):
cout<<x[1]+x[2];
break;
case('-'):
cout<<x[1]-x[2];
break;
case('*'):
cout<<x[1]*x[2];
break;}
cout<<endl;}while(d=1);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment