I was using cout. But anyway I fixed it:
Code:
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cmath>
#include <iostream>
using namespace std;
float Squareroot(float x);
float Add(float x, float y);
float Subtract(float x, float y);
float Multiply(float x, float y);
float Divide(float x, float y);
int main() {
cout << "Math Program v.1.8" << endl;
float numberA;
float numberB;
cout << "What two numbers would you like to input?" << endl;
cin >> numberA;
cin >> numberB;
cout << "Would you like to: \n" ;
cout << "Square[r]oot?" << endl;
cout << "[a]dd" << endl;
cout << "[s]ubtract" << endl;
cout << "[m]ultiply" << endl;
cout << "or [d]ivide the numbers?" << endl;
float funcvarbname;
string Option;
cin >> Option;
if (Option == "r") {funcvarbname=Squareroot(numberA);};
if (Option == "a") {funcvarbname=Add(numberA, numberB);};
if (Option == "s") {funcvarbname=Subtract(numberA, numberB);};
if (Option == "m") {funcvarbname=Multiply(numberA, numberB);};
if (Option == "d") {funcvarbname=Divide(numberA, numberB);};
cout << "YOUR ANSWER IS: " << funcvarbname << endl;
system("PAUSE");
return 0;
}
float Squareroot(float x) {
return sqrt(x);
}
float Add(float x, float y) {
return x+y;
}
float Subtract(float x, float y) {
return x - y;
}
float Multiply(float x, float y) {
return x*y;
}
float Divide(float x, float y) {
return x / y ;
}