that is the exercise I'm doing currently and this is the code I have currently.
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
bool quit = true;
float x = 0;
float y = 0;
// Menu
while (!quit)
{
cout << "1) cos(x), 2) sin(x), 3) tan(x), 4) atan2(y, x), 5) sqrt(x), 6) x^y, 7) ln(x), 8) e^x, 9) |x|, 10) floor(x), 11) ceil(x), 12) Exit." << endl;
int selection;
cin >> selection;
switch(selection)
{
case 1:
float cosf(float x);
cin >> x;
case 2:
float sinf(float x);
cin >> x;
case 3:
float tanf(float x);
cin >> x;
break;
case 4:
float acosf(float x);
cin >> x;
break;
case 5:
float asinf(float x);
cin >> x;
break;
case 6:
float atanf(float x);
cin >> x;
break;
case 7:
float sqrtf(float x);
cin >> x;
break;
case 8:
float logf(float x);
cin >> x;
break;
case 9:
float expf(float x);
cin >> x;
break;
case 10:
float powf(float x, float y);
cin >> x;
cin >> y;
break;
case 11:
float fabsf(float x);
break;
case 12:
quit = false;
}
}
}
As you might be able to see I wasn't even able to include all the math functions and even with those math functions my code seem's to be all fudged up. If anyone can fill me in on how and what I should be doing with this program and how I can correct it, that would be greatly appreciated. Thanks in advance!