Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Inventory
- {
- string[] arrayItems = new string[6];
- int itemsCount = 0;
- public void AddItem(string item)
- {
- if (itemsCount >= 6)
- {
- Console.WriteLine("Inventory full");
- }
- else
- {
- arrayItems[Array.IndexOf(arrayItems, null)] = item;
- itemsCount++;
- Console.WriteLine("{0} has been added to your inventory. Number of items:{1}", item, itemsCount);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment