my program records the number of bottles four rooms has collected in a bottle drive. When the user types in quit, the number of bottle each room has collected is shown as well a
You could do that, but that would be a step back from good programming and towards writing bad code.
First it would bloat your code, since you always had to do something like this:
// this is the code you have now (3 lines for 4 rooms):
int room = int.Parse(quit);
Console.Write("Bottles collected in room {0}: ", room);
rooms[room - 1] += int.Parse(Console.ReadLine());
// and this is the code you'll have when you refrain from using arrays
// (17 lines for 2 rooms, ignoring empty lines and ones with only brackets):
int room = int.Parse(quit);
Console.Write("Bottles collected in room {0}: ", room);
switch(room)
{
case 1:
Console.WriteLine(room1);
break;
case 2:
Console.WriteLine(room2);
break;
// other cases...
}
int count = int.Parse(Console.ReadLine());
switch(room)
{
case 1:
room1 += count;
break;
case 2:
room2 += count;
break;
// other cases...
}
And second (and far more important):
The code is totally not extensible. If you want to add a fifth room to collect bottles in, you have to go through the whole program and adjust each and every switch statement, which is not only time consuming but also extremely prone to error.