Thread: soda machine program

  1. #1
    Registered User
    Join Date
    Feb 2005

    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.

  2. #2
    Join Date
    Aug 2002
    Tucson, Arizona
    The only thing I saw was in sodaMachine::sodaSelection(). Why do you use that array when a single int would do.
    int 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.
    Last edited by prog-bman; 05-01-2006 at 04:22 AM.

  3. #3
    Registered User
    Join Date
    Apr 2006
    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..

      cout << "please enter code:  "; cin >> 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

  4. #4
    Registered User
    Join Date
    Feb 2005
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. c++ program for ATM machine
    By cplus2x in forum C++ Programming
    Replies: 2
    Last Post: 02-06-2008, 04:35 AM
  2. Using variables in system()
    By Afro in forum C Programming
    Replies: 8
    Last Post: 07-03-2007, 12:27 PM
  3. BOOKKEEPING PROGRAM, need help!
    By yabud in forum C Programming
    Replies: 3
    Last Post: 11-16-2006, 11:17 PM
  4. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM