#array assignment
9 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.
That's Ezz , What's The Problem in It?
can i use for loop in this program or not?
Can? lOl , Tis Could Only Be Sort By Using Loops.
uhuh, so i tried it using this code is this okay ?
string color, array[9] = {"Taken", "Single and Happy", "Marupok", "It's Complicated", "Study First", "Friend zone", "Strict Parents", "Madaming Crush Kahit Saan", "Killjoy"};
cout << "Enter a Color: ";
cin >> color;
cout << endl;
if (color == "Pink" || color == "pink")
{
cout << array[0];
........
Yea, Sounds Good I Guess The Qs Is Somethin Else.
#include <iostream>
#include <string>
#define AMT_CODE 9
int main()
{
const std::string dressColor[AMT_CODE] = {"Pink", "Yellow", "Orange", "Blue", "White", "Green", "Black", "Violet", "Uniform"};
const std::string dressCode[AMT_CODE] = {"Taken", "Single and Happy", "Marupok", "It's Complicated", "Study First", "Friendzone", "Strict Parents", "Madaming Crush kahit Saan", "Killjoy"};
int acceptingUserInput = 1;
while (acceptingUserInput)
{
std::cout << "Enter the index value (0 to 9, -1 to exit): ";
int idx = 0;
std::cin >> idx;
if (idx == -1)
{
break;
}
if (idx < 0 || idx > 8)
{
std::cout << "Invalid index value\n";
}
else
{
std::cout << dressColor[idx] << "\n";
std::cout << dressCode[idx] << "\n";
}
std::cout << "\n";
}
return 0;
}
Something like this could work
!solved