Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Ayaahmed211 authored Sep 29, 2023
1 parent ce6d415 commit 6eccd8d
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions simple calculator.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#include <iostream>
using namespace std;

int main()
{

char operation;
float x ,y ;
cout<<"Enter the operation (+ or - or * or /) : "<<endl;
cin>>operation;
cout<<"Enter the two numbers, taking into consideration that the order is important in some operations "<<endl;
cin>>x>>y;
switch(operation)
{
case'+':
cout<<x<<"+"<<y<<"="<<x+y;
break;
case'-':
cout<<x<<"-"<<y<<"="<<x-y;
break;
case'*':
cout<<x<<"*"<<y<<"="<<x*y;
break;
case'/':
cout<<x<<"/"<<y<<"="<<x/y;
break;
default:
cout<<"ERROR! operation is not found "<<endl;
break;
}

return 0;
}

0 comments on commit 6eccd8d

Please sign in to comment.