Simple C++ Calculator Program Getting User Input Using functions - HelpMeOutAlways

Thursday, October 4, 2018

Simple C++ Calculator Program Getting User Input Using functions

Source Code

#include<iostream>
#include<conio.h>
using namespace std;
void calculator(float a, float b){
cout<<"Enter any two value:"<<endl;
cin>>a>>b; //geting input from user

cout<<"Sum is : "<<a+b<<endl;//sum operation

cout<<"Subtraction is:"<<a-b<<endl;//sub operation

cout<<"Multiplication is :"<<a*b<<endl;//multly operation

cout<<"Division is : "<<a/b<<endl;

}

int main(){
float a,b;
calculator(a,b);
calculator(a,b);

getche();

}

Output 

c++  program using function


No comments:

@way2themes