Question: I am working on a normal program where user enters names and it gets stored in an array.Two options are given,enter 1 for adding name

I am working on a normal program where user enters names and it gets stored in an array.Two options are given,enter 1 for adding name and again restarting to main menu and if 2 is entered ,then the array of names is printed out.Basically,i think my program functionality is good ,but i am getting an error which is stopping my program to run.

#include #include

using namespace std;

int main () {

string trees[10]; bool a = true;

while(a == true){ int input; cout << "Enter 1 or 2 " << endl; cin >> input; if (input == 1) { cout << "Please enter the Names: "; cin >> trees;

a = true; } else if (input == 'f') { for (int i = 0; i < 9; i ++){ std::cout << trees[i] << " "; } a = false; } else { cout << "Wrong Input"; a = false; }

} }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!