Question
I'm trying to use a void function and search array to isolate characters of a user generated item number. Theitem number must total 5 characters
I'm trying to use a void function and search array to isolate characters of a user generated item number. Theitem number must total 5 characters and the middle character must be one of the listed letters. The item number will corrolate with a listed color. What am I doing wrong?
#include
int main () { string part = "";
//Get item number then extrapolate cout << "Please enter item number: "; getline(cin, part); return 0; } //end of main function
void searchArray(); string colors[4] = {"BLUE", "RED", "GREEN", "WHITE"}; string part = "";
cout << "Please enter item number: "; getline(cin, part);
while (part.length() == 5); { if {(middle(part) == "B" || "b"); cout << "BLUE" << endl;} else if {(middle(part) == "R" || "r"); cout << "RED" << endl;} else if {(middle(part) == "G" || "g"); cout << "GREEN" << endl;} else if {(middle(part) == "W" || "w"); cout << "WHITE" << endl;} else {cout << "Invalid Item" << endl;} } else while {(part.length() != 5;) cout << "Invalid Item" << endl;} //end while }
return 0; } //end of void function
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