double Robot::Mierz() {
if(!wlaczony || !jedzie)
return -1;
else
for(int i=0; i<=10; i++){
double random = rand();
suma = suma + random;
}
return suma;
}
double Robot::Srednia() {
if(!CzyWlaczony) {
return -1;
}
else {
int srednia = suma/10;
}
return srednia;
}
class Robot {
public:
double Mierz();
double Srednia();
private:
double suma=0;
};
Cześć, ucze sie obiektowego pisania codu w c++ , zrobilem klase Robot, która ma mierzyc dlugosc i srednia, ale niestety nie działa - problem z tymi metodami.