I am making a program that asks the user how many robots they want to create. They then need to name those robots, and it is then stored in an array of structs.
The struct userRobot
will have other values like x-y coordinated but since I'm just starting on the project I just want to start with names first.
Everything works fine until I want to print the array, which gives me the error:
error: no match for operator<< ...
#include <iostream>
using namespace std;
int main()
{
struct userRobot{
string name;
};
int NumberOfRobots;
string robotName;
cout << "Enter the number of robots" << endl;
cin >> NumberOfRobots;
cout << endl << "Enter their name(s)" << endl;
userRobot RobotArray[NumberOfRobots];
for(int i=0;i<NumberOfRobots;i++){
cin >> robotName;
RobotArray[NumberOfRobots - NumberOfRobots].name = {robotName};
}
for (int j = 0; j < NumberOfRobots; j++){
cout << RobotArray[j] << endl;
}
return 0;
}