error "not declare in scope"

I am working on creating a Robot shop, I've first created parts,then added main menu, now I am trying to add Robotmodel in the menu. I don't understand the logic of these errors
'RobotModel’ was not declared in this scope
‘robotModel’ was not declared in this scope
‘RobotModel’ does not name a type


class RobotModel {
public:
RobotModel(double cost, int model_number, string name, PartType torso_pt,
PartType head_pt, PartType locomotor_pt, PartType arm_pt, PartType
battery_pt)
: _cost{cost}, _model_number{model_number}, _name{name},

_torso{torso_pt}, _head{head_pt}, _locomotor{locomotor_pt}, _arm{arm_pt},
_battery{battery_pt} { }

int model_number() const {return _model_number;}
double cost() const {return _cost;}
double max_Speed() const {
robotParts[partNumber]->getMaxSpeed();
return _max_Speed;
}
double max_battery_life() const { return max_battery_life;}
RobotModel( Vector<RobotPart *> &robotParts, const String &name, int modelNumber, double price);
const Vector<RobotPart *> &getRobotParts() const;

private:
string _name;
int _model_number;
PartType torso;
PartType head;
PartType locomotor;
PartType arm;
PartType battery;
vector<RobotPart*> robotParts
double _cost;
};



#include <iostream>
#include "robot_part.h"

using namespace std;

int main() {

Head *head;
Arm *arm;
Torso *torso;
Locomotor *locomotor;
Battery *battery;
RobotModel *robotModel;

while(true) {
switch (get_int(R"(
Testing Robot Parts


(1) Create Head
(2) Create Arm
(3) Create Torso
(4) Create Locomotor
(5) Create Battery
(6) Robot Model
(0) Exit

Selection? )", 0, 6)) {

case 0: // Exit
exit(0);
case 1: // Head
head = new Head{};cout << *head << endl;
break;
case 2:
arm = new Arm{};cout << *arm << endl;
break;
case 3:
torso = new Torso{};cout << *torso << endl;
break;
case 4:
locomotor = new Locomotor{}; cout << *locomotor << endl;
break;
case 5:
battery = new Battery{}; cout << *battery << endl;
break;
case 6:
robotModel = new RobotModel{
get_string("Enter this robot model name: "),
get_int("Enter this robot model number: "),
get_double("Enter this robot model's cost: "),
get_string("Enter description: "),
get_double("Enter maximum energy: "),
get_double("Enter power available: ")
};
cout << *robotModel << endl;
break;
default:
cerr << "////////" << endl << endl;
}
}
}
Last edited on
Please use code tags: http://www.cplusplus.com/articles/z13hAqkS/

If you have errors, post them here in full, verbatim, with the correct line numbers. Post something we can compile.
Topic archived. No new replies allowed.