Hey I need help with C++ Have like lots of mini programs to make and am a total noob with programming don't have a clue. help would be appreciated. Below is a list of the first two programs I have to create: 1) 'Unique' algorithm to check whether all elements of a set of integers are distinct [user input] Need to use many counter variables. 2) Vending machine program that represents the change giving function. Use counter variable.
here's the logic that I can give to you 1) make an array or set or list or any kind of data set. put the integer that user input, then everytime we put in new integer, search in to data set whether it is already inside. if no then put them in else show some error message 2) make a set of price of the items and set of possible amount of money or token (10 cent, 25 cents, 50 cent, 1 dollar = 100 cent) better to put all the price to cent. (1.50 $ = 150 cents). receive the money until it is equal or greater than the price of the item selected. if it is equal there will be no change, and if it is more than the price, subtract amount receive with item price. then divide the change into possible money/ token. Hope it helps!
For details about all kind of programming languages and web design. You can also get details about web development visitorsstatistics.com
I know the code to finding the maximum of a set of input integers but how do I find the UNIQUE number For example. User enters... 1, 1, 2, 3, 4, 4, 5, 5 2 & 3 are unique numbers as they are not duplicated. what is the code for finding this out?
You could make an array, and go through the array with a for loop checking for duplicates. I won't write the code for you though, as this seems like a school assignment.