So acos is a function declared in header file cmath that calculates arc cosine. In the program, it returns a value that's passed to std::cout to be printed on the screen.
How do i know if the value returns something or not?
That's what declarations are. They tell the compiler (and you) what type things are.
// function definition
int myFunction()
{
return 4; // <-- this is the value you are returning from your function
}
int main()
{
int num = 10;
num = myFunction();
return 0; // <-- at this point 'num' would be 4
}
for the simplest explanation and code
heres the code
1 2 3 4 5
int main()
{
return 0; // if the program function main reached this return 0,in any function, it means that the programs is success without bug,
}
second
1 2 3 4 5 6
int exFunction(int val1,int val2)
{
int result;
result= val1+val2
return result; //this return will return the val1+val2 which means if you use this function the the value will be added together..and only "add together " will happen
}
1 2 3 4 5 6
int exFunction ( int val1,int val2)
{
int result;
return val1+val2; // no difference in the 2nd snippet
}