Z
Zenon
Folks,
I cannot figure out why I am getting an error: Error E2303 EngineX.hpp
19: Type name expected. Here is my code. Can you please help?
#ifndef EngineX__hpp
#define EngineX__hpp
#include<iostream>
#include <cstring>
#include <cmath>
#include <sstream>
#include <fstream>
class EngineX : public Engine
{
// Define data members
int horsepower;
// define function prototypes
public:
EngineX(int hp); // Constructor with hp input
~EngineX();// Destructor
std::string name(); // returns engine name
double torque(double rpm, double fuelRate);// returns engine torque
};
#endif
#include <cstring>
#include <cmath>
#include<iostream>
#include <fstream>
#include <vector>
#include <iomanip>
#include <sstream>
#include "EngineX.hpp"
using namespace std;
EngineX::EngineX(int hp) // Constructor with hp input
{
horsepower = hp;
}
EngineX::~EngineX()// Destructor
{}
string EngineX::name() // returns engine name
{
stringstream ss;
ss << horsepower;
string b(ss.str());
return ("EngineX " + b + "HP");
}
double torque(double rpm, double fuelRate) // returns engine torque
{
double lrpmx = 0;
double engineTorque = 0;
double torque = 0;
lrpmx = rpm / 1000;
torque = ((-130*lrpmx*lrpmx*lrpmx) + (-600*lrpmx*lrpmx) - (791 *
lrpmx) + 2);
engineTorque = fuelRate*torque;
return engineTorque;
}
thanks very much,
Zenon
I cannot figure out why I am getting an error: Error E2303 EngineX.hpp
19: Type name expected. Here is my code. Can you please help?
#ifndef EngineX__hpp
#define EngineX__hpp
#include<iostream>
#include <cstring>
#include <cmath>
#include <sstream>
#include <fstream>
class EngineX : public Engine
{
// Define data members
int horsepower;
// define function prototypes
public:
EngineX(int hp); // Constructor with hp input
~EngineX();// Destructor
std::string name(); // returns engine name
double torque(double rpm, double fuelRate);// returns engine torque
};
#endif
#include <cstring>
#include <cmath>
#include<iostream>
#include <fstream>
#include <vector>
#include <iomanip>
#include <sstream>
#include "EngineX.hpp"
using namespace std;
EngineX::EngineX(int hp) // Constructor with hp input
{
horsepower = hp;
}
EngineX::~EngineX()// Destructor
{}
string EngineX::name() // returns engine name
{
stringstream ss;
ss << horsepower;
string b(ss.str());
return ("EngineX " + b + "HP");
}
double torque(double rpm, double fuelRate) // returns engine torque
{
double lrpmx = 0;
double engineTorque = 0;
double torque = 0;
lrpmx = rpm / 1000;
torque = ((-130*lrpmx*lrpmx*lrpmx) + (-600*lrpmx*lrpmx) - (791 *
lrpmx) + 2);
engineTorque = fuelRate*torque;
return engineTorque;
}
thanks very much,
Zenon