-
soda machine program
Hello everyone!
I have been learning about classes and this is my first program using classes.
I would like to know how bad I did.
I am interested in opinions.
Also I have a constant global there and I am not sure this is a good way to declare this variable.
-
The only thing I saw was in sodaMachine::sodaSelection(). Why do you use that array when a single int would do.
Code:
int code;
cin>>code;
switch(code)
{
//do your choices here
}
//finish up
Oh and the same function your thank you message should be outside of the loop not in it.
-
Hey man this part of the code is wrong ...
i and j have out of boundary values after the for loop...
you ask the user to give softDrinkCode[3][2] which is a logic mistake..
Code:
cout << "please enter code: "; cin >> softDrinkCode[i][j];
switch(softDrinkCode[i][j])
so you should get i and j separately from the user or you could do what prog-bman said ...
and next time try to find your mistakes in the program by testing it thoroughly yourself ;)
-
definately some good advice friends. I used a two dimensional array so I could use codes like a1, or b2 etc.. but I did not get it figured out yet.
I also noticed that my thank you not was outside the loop. oops! that was a mistake I should have found.
Also, I am not quite used to two dimensional arrays and such but with input from others and practice I will get better.
Thanks for the tip on separating i and j.