these are the goals of the assignment i am trying to complete, i am running into a problem where i need to create a function get the product the customer selected and reutrn that information in a cout that also inculdes information from another function, i got the first part alrighjt but i completely draw a blank when trying to figure out the 2nd and 3rd part
thanks in advance for any assistance
○ Ask customers to select multiple products and quantities
○ Print the order summary, including the products, the quantities, and the total price for each product
-Calculate and print the total price for the order

     // Customer Names  & Product Menu
#include <iostream>
using namespace std;

//Function Prototypes
int getProduct (string)   
int getQuanity(string)
double printTotal(int,int)

int main(void)
{
char selection = ' ';
string name = "";

//Customer Name input
cout << "What is your name please? ==> "<< endl;
getline(cin, name);

//User enterned name displayed
cout << "Welcome to Product Selection " + name << endl;

do
{
    cout << "Please choose your product from the Selections below" << endl;
    // Product Menu 
    cout << "Product Menu";
    cout << "========" << endl;
    cout << "Milk - 2.50" << endl;
    cout << "Eggs - 2.00" << endl;
    cout << "Soap - 3.50" << endl;
    cout << "X - Exit " << endl << endl;
    cout << "Enter selected Product: ";
    // Show the user selected product
    cin >> selection;

    switch (selection)
    {
    case '1':
        cout << "You have Selected Milk which is $2.50 " << endl;
        // getProduct  ? isnt this redundent as the menu is asking them to select a prodcut already?
        getQuanity;
        printTotal;
        break;
    case '2':
        cout << "You have Selected Eggs which are 2.00" << endl;
        getQuanity;
        printTotal;
        break;
    case '3':
        cout << "You have Selected Soap which is 3.50" << endl;
        getQuanity;
        printTotal;
        break;
    case 'X':
    case 'x':
        cout << "Thank you for your business" << endl;
        break;
        // invalid selection menu if option chosen outside menu selection
    default: cout << "Selection Unavaliable, Review selection & try again " << endl;

        // no break in the default case
    }
    cout << endl << endl;
} while (selection != 'X' && selection != 'x');
// 

return 0;
}

int getProduct(); // How do i get this function to Pull the string from the selection the user 
// made in the above menu? isnt the (switch
    {
cout << "Your Selected Product is  "    

}

int getQuanity;
{

int getQuanity; 

cout << "Please Select The amount of this Item  you would like" << endl;
cin >> getQuanity;

return getQuanity;

}
double printTotal(int,int);
{
int printTotal  
cout <<"Your Total is"<< getQuanity * getProduct << "Thank you for your Business" << endl;

return printTotal;  
}

I would suggest that you need something to represent a product. In this case a struct would do, but, I think a class would be better. Either way, this allows you to store Product objects in a vector<Product>. Getting a summary with totals is simply a matter of looping through the vector.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.