Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Server Query Performance Tuning

Authors: Sajal Dam, Grant Fritchey

4th Edition

1430267429, 9781430267423

More Books

Students also viewed these Databases questions