I am trying to create a function with an array of names inserted and creating a slip function. Lets assume Day1 there are 2 buyers (Zee and Zoe) and Day2(Eddie and Zoe), Day3(Mike and Jo). Meaning there will be 5 slips for Zee, Zoe and Eddie showing the number bought and total charge.
You really haven't asked a clear question. Not sure what problem you're having.
line 26: What is the purpose of the name array? It goes out of scope when getBuyersDetails() exits. The information in it is not saved.
Lines 11-14: I really think these lines should be a separate struct (or class). You would then have an array of that struct. The object you want to deal with is a slip, not a truck.
I've made changes to the above code.
if more then one name is inserted i want the slip function to pick that up and create individual slips for all that bought the ice cream. Im not good at explaining
You've changed the name of the class from iceCreamTruck, to just iceCream, but you haven't changed the functionality. As I pointed out previously, the object you want to deal with is a Slip, not an iceCream. Frankly, I found your code very hard to follow.
I don't know if you've learned maps yet. Here's a cleaned up version of your code.
Thanks for the code.
I added a line between line 29 and 30 for the 2 days of buying
for (size_t number = 0; number<DAYS_BUYING; ++number)
Output is
Day of the week: wednesday
How many buyers: 2
Name of Buyer 1: Eddie
Number of icecrem sold to Eddie: 1
Name of Buyer 2: Sam
Number of icecrem sold to Eddie: 1
*************************
Day of the week: Thursday
How many buyers: 1
Name of Buyer 1: Eddie
Number of icecrem sold to Eddie: 1
**************************
-----------SLIP-------------------------
Instead of printing only 2 slips for Sam and Eddie(adding wednesday and Thurs). It prints 3 slips