You have a basket. You want to add Sandwiches and Sodas while keeping a separate list for each item that are added to the
Basket. You don't want the user to worry about two separate functions, addSandwich( ) and addSodas( ). You want to make the "add" easy for the user, so you decide to abstract away the design of your add function. All good.
databases and web pages.
Arrays provide a way to store multiple pieces of information in a single thing. An array is basically a list of values: numbers, strings, boolean values or even other arrays or objects!
Loops are a way of repeating code -- they're very handy for repetitive tasks. Loops are frequently used to cycle through an array and perform an action on each item in the array.
If you're asking for logic errors -
the rand() function could return you the same number. So you could end up displaying only one value out of the four, twice!
to handle that, change this line
int defineObject2 = rand() % 3 + 1;
Hi Penny, I agree with Kenneth. Having said that, if you're looking for some pointers(not C++ pointers:) to start off your programming, here are some hints
1. Initialize the max credit and available credit to the same number for each customer (this would go in your customer...
Hi Murshed, if you know how to use them, you can use either. As my fellow tutors pointed out they both can be written to give you the same result.
As a rule of thumb, if you find yourself copying and pasting the same code over and over, think for loop. If you want to break your loop...
From what I gather from your question - The game picks two random numbers and a random operator. It exposes the operator along with one of the random numbers and asks the user to guess the undisplayed random number. Is that the requirement?