#array assignment

9 messages · Page 1 of 1 (latest)

keen depot
#

array
hello, can someone please help me with my activity I'm still a beginner and I still have 4 pending activities

velvet viperBOT
#

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.

sturdy egret
keen depot
sturdy egret
keen depot
# sturdy egret 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];

........

sturdy egret
warm folio
#
#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

keen depot
#

!solved