using namespace std;
int squareArea(int &);
int circleArea(int &);
int main()
{
int a = 10;
cout<<squareArea(a)<<" ";
cout<<circleArea(a)<<" ";
cout<<a<<endl;
return 0;
}
int squareArea(int &a)
{
return a = a;
}
int circleArea(int &r)
{
return r = pir*r;
}
Errors are:
In function int circleArea(int&)':
converting toint' from `float'
I kinda understand the second one but not sure what the first one is all
about.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It's because pi is defined as a float and everything else is an int, so it has
to convert the answer to an int when using pi in the circleArea function.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I just can't get this to work
include<iostream>
define pi 3.14f
using namespace std;
int squareArea(int &);
int circleArea(int &);
int main()
{
int a = 10;
cout<<squareArea(a)<<" ";
cout<<circleArea(a)<<" ";
cout<<a<<endl;
return 0;
}
int squareArea(int &a)
{
return a = a;
}
int circleArea(int &r)
{
return r = pir*r;
}
Errors are:
In function
int circleArea(int&)': converting to
int' from `float'I kinda understand the second one but not sure what the first one is all
about.
It's because pi is defined as a float and everything else is an int, so it has
to convert the answer to an int when using pi in the circleArea function.
Define pi as a float