Working with C++ (Codeblocks 17.12 compiler), everytime program sees 'cout' in program.cpp i kept getting this message. Ideally need to create 'GoodAuto' object with three inserted variables (fuel_amount, double fuel_consumption and double best_speed); ability to change them with _change variables; ability to delete that 'GoodAuto' object.
Thanks in advance.
main.cpp
#include <iostream>
#include "program.h"
using namespace std;
int main(){
Auto GoodAuto(200, 5, 60);
}
program.cpp
#include "lvtocon.h"
#include <iostream>
#include "program.h"
using namespace std;
Auto::Auto(double fuel_amount, double fuel_consumption, double best_speed)
{
cout << "Enter fuel amount: " <<endl;
this->fuel_amount = (fuel_amount>=0)?fuel_amount: 10;
cout << "Enter fuel consumption for 100 km: " <<endl;
this->fuel_consumption = (fuel_consumption>0)?fuel_consumption: 1;
cout << "Enter optimal car speed: " <<endl;
this->best_speed = (best_speed>0)?best_speed: 120;
}
void Auto::Change(double fuel_amount_change, double fuel_consumption_change, double best_speed_change)
{
if (fuel_amount+fuel_amount_change>0) this->fuel_amount += fuel_amount_change; else fuel_amount = 0;
if (fuel_consumption+fuel_consumption_change>0) this->fuel_consumption += fuel_consumption_change; else fuel_consumption = 1;
if(best_speed + best_speed_change>0) this->best_speed += best_speed_change; else best_speed = 120;
}
void Auto::Print(){
cout << "Fuel amount = " << fuel_amount << " l."<< endl;
cout << "Fuel consumption for 100 km = " << fuel_consumption << " l/stunda." <<endl;
cout << "Auto optimal speed = " << best_speed <<" km/stunda."<<endl;
}
program.h
class Auto
{
private:
double fuel_amount;
double fuel_consumption;
double best_speed;
public:
Auto(double fuel_amount, double fuel_consumption, double best_speed);
~Auto();
void Change(double fuel_amount_change, double fuel_consumption_change, double best_speed_change);
void Print();
};