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
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started