void entry(int itemsales1[255][255], int itemcount1, string itemnames1[255])
{
    int count;
    char *days[]={"Monday", "Tuesday", "Wednesday", "Thursday", "Friday"};
    
    cout << "Enter item's name: ";
    cin >> itemnames1[itemcount1];

    for (count = 0; count < 5; count++)
    {
        cout << "Enter " << days[count] << " sales: ";
        cin >> itemsales1[itemcount1][count];
    }

    return(itemsales1, itemcount1, itemnames1);
}

I was curious, I want this to return a string as well as the ints, what type of function would I have to make this to do so?

Recommended Answers

All 3 Replies

Nevermind guys, thanks if you looked, but I solved it by:

int entry(int itemsales1[255][255], int itemcount1, string itemnames1[255])
{
    int count;
    char *days[]={"Monday", "Tuesday", "Wednesday", "Thursday", "Friday"};
    
    cout << "Enter item's name: ";
    cin >> itemnames1[itemcount1];

    for (count = 0; count < 5; count++)
    {
        cout << "Enter " << days[count] << " sales: ";
        cin >> itemsales1[itemcount1][count];
    }

    return(itemsales1, itemcount1, (int*)itemnames1);
}

Completely forgot about casting sorry.

/bonk

Since you're using C++, don't you think it's unwise to use the old C-style casts?

Yes, but for what I'm doing right now, it's useful because I won't have to take an extremely long cut. It's about an assignment and we are not allowed globals. Thanks though.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.