Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create gradefinder #38

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 94 additions & 0 deletions gradefinder
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
#include <iostream>
using namespace std;

int addition (int num1, int num2);
int subtraction (int num1, int num2);
int division (int num1, int num2);
int multiplication(int num1, int num2);



int main()
{
char option;
int num1, num2, result;

cout<<"\n\t\t\tSimple calculator"<<endl;
do
{

cout<<"Enter + for Addtion\nEnter - for Subtraction\n
Enter / for Division\nEnter * for Multiplication\n
Enter E to EXIT\n";
cout<<"\n\t\t\tEnter Option: ";
cin>>option;

if(option!='e'&&option!='E')
{
cout<<"\n\t\t\tEnter First Number: ";
cin>>num1;
cout<<"\n\t\t\tEnter Second Number: ";
cin>>num2;
}

if(option!='+'&&option!='-'&&option!='/'
&&option!='*'&&option!='e'&&option!='E')
{
cout<<"\n\t\t\tSELECT the VALID OPTION\n";
}
else if(option=='+')
{
result=addition(num1,num2);
cout<<"\n\t\t\t"<<num1<<" + "<<num2<<" = "<<result<<endl;
}
else if(option=='-')
{
result=subtraction(num1,num2);
cout<<"\n\t\t\t"<<num1<<" - "<<num2<<" = "<<result<<endl;
}
else if(option=='/')
{
result=division(num1,num2);
cout<<"\n\t\t\t"<<num1<<" / "<<num2<<" = "<<result<<endl;

}
else if(option=='*')
{
result=multiplication(num1,num2);
cout<<"\n\t\t\t"<<num1<<" X "<<num2<<" = "<<result<<endl;

}



}while(option!='e'&&option!='E');


cout<<"\n\t\t\tProgram EXIT Successfully.......\n\t\t\t";
return 0;
}
int addition(int num1, int num2)
{
return (num1+num2);
}

int subtraction(int num1, int num2)
{

return (num1-num2);
}

int division(int num1, int num2)
{
if(num2==0)
{
cout<<"\n\t\t\tDivide by ZERO not allowed :"<<endl;
return 0;
}
return (num1/num2);
}

int multiplication(int num1, int num2)
{
return (num1*num2);
}