The only thing wrong at compile time is the lack of a return statement:
Code:
#include <string>
#include <cmath>
using namespace std;
inline float tang(string A_O_Aj, float angle, float opposite, float adjacent)
{
float x = 0;
if(A_O_Aj == "A")
{
x = opposite / adjacent;
x = atan(x);
x = x * (180 / 3.141592);
return x;
}
if(A_O_Aj == "O")
{
x = angle * (3.141592 / 180);
return x;
}
if(A_O_Aj == "Aj")
{
x = opposite / (tan(angle * (3.141592 / 180)));
return x;
}
}
int main()
{
tang("A", 1, 2, 3);
}
The compiler output:
Code:
test.cpp: In function 'float tang(std::string, float, float, float)':
test.cpp:29: warning: control reaches end of non-void function
If you disagree, post the smallest and simplest program that demonstrates the error, and post the exact error message.