Ok, I am setting all elements in the array to 0...
If all elements are 0, i want it to display "No inventory"
if there is something in the element, i want to display only its contents..

Heres the code, how do I make it display No Inventory only when all are 0, not every single 0.

for (int i = 0; i < size; i++)             
{
   item[i] = 0;
}
for (int j = 0; j < size; j++)
    if (item[j] == 0)
    cout<<"No Inventory";
    else 
         cout<<item[j]<<endl;
}

In that last loop you have to just count the number of items that are zero. Then after the end of the loop if the counter is still zero you can display the "no Inventory" message.

Is there a function in C++ where a string can be held in a Unsigned array?

Is there a function in C++ where a string can be held in a Unsigned array?

I don't know how that relates to your original question, but its not called a function but a container. such as vector<string> array; . Or if you mean you want to put a c-style null-terminated string into an array, then try vector<char*> array;

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.