Why cant I pass variables into a void printPoint function, and not have to return a float ave. I tried just printing the coordinates but I got too errors.
so my function looked like this
void printPoint(float x , float y, float z){
cout << " < " << x << " , " << y << " , " << z << " > " << endl;
}
any ideas on how you over come this problem?
#include <iostream>
#include <string>
using namespace std;
float printPoint(float x, float y, float z);
int main()
{
int y = 0;
float e,b,c, num , number = 0.0f;
while(true)
{
for (int i = 88; i < 91; i++)
{
char a = i;
cout << "Enter the " << a << " coordinate: ";
cin >> number;
++y;
switch(y)
{
case 1:
e = number;
number = 0.0f;
break;
case 2:
b = number;
number = 0.0f;
break;
default:
c = number;
number = 0.0f;
break;
}
}
y = 0;
cout << endl;
num = printPoint(e, b, c);
cout << " Avarage: " << num << endl;
if(num == 1)
break;
}
}
float printPoint(float x , float y, float z){
cout << " < " << x << " , " << y << " , " << z << " > " << endl;
float count = (x + y + z ) / 3;
return count;
}