| skittlesaddictx50v (47) | |||
|
Say I get user input. If what they type in is not already in the array(how do I check an array?), add it to the array. And vice versa how do I remove something from an array given the user input. Example:
| |||
|
|
|||
| vichu8888 (176) | |||
|
In the above case, its an array of 4 elements teams[4]. As the array size is fixed, it may not be possible to remove an item from the array. Rather, you can assign null or someother value to the corresponding element. Suppose user wants to add city 'texas' and he wants to remove 'dallas', then in this case
Other than this, string function such as string find,string compare are available. you may make use of those | |||
|
Last edited on
|
|||
| rollie (304) | |
| In this case, why not use an std::list<string> instead of an array? | |
|
|
|