I am trying to make a simple calculator and the only problem I am having so far is returning my variables to the main function for another function to use. This is what I have so far.
#include <iostream>
#include <math.h>
using namespace std;
//Prototypes
//Retrieves the operator, operand and returns operator
//and operand
double scan_data(char&, double&);
//Reads operator and operand and uses switch statement
//to perform correct operator on the operand
double do_nex_op(char, double, double&);
//Reads result and outputs the result of the operator
//and the operand
// obtain operator and operand, and display operator
// and operand
scan_data(op,num);
// obtain results from operator and operand
do_nex_op(op,num,sum);
// display results
do_next_op(sum);
return 0;
}
// function to obtain original values
double scan_data()
{
char op;
double num;
cout<< "This program is a very basic calculator \n";
cout<< "use only operators +,-,*,/, or ^";
cout<<" to raise a number to a power\n\n";
cout<< "Enter a valid operator:\n";
cin>> op;
cout<< "\n Enter any number:\n";
cin>> num;