I have to make my sample run look like this . I cannot seem to get it right.

Sample run

Welcome to Vending Machine capable of deep frying twinkies
Please insert coin:
Enter D or d for Dollar
Enter Q or q for Quarer
Enter M or m for Dime
Enter N or n for Nickle
Enter X or x to stop

It cost $3.50 for a deep-fried twinkie.
Your have inserted: $0.00
Your choice : D

It cost $3.50 for a deep-fried twinkie.
Your have inserted: $1.00
Your choice : f

It cost $3.50 for a deep-fried twinkie.
Your have inserted: $3.55
Purchase Completed!
Your change: $0.05

This is what I have so far. Here are my codes.

#include <iostream>

using namespace std;
const double twinkies_Price = 3.50;

const double DOLLAR = 1.00;

const double QUARTER = 0.25;

const double DIME = 0.10;

const double NICKEL = 0.05;

int accept_money();

int computer_change ( int total_paid );

int main()
{
    const double DOLLAR = 1.00;

    const double QUARTER = 0.25;

    const double DIME = 0.10;

    const double NICKEL = 0.05;

    int choice;
    double moneyEnter =0.0;
    cout << "Welcome to Vending Machine capable of deep frying twinkies.\n\n";

    cout << " Please insert coin: \n";
    cout << " Enter D or d for Dollar which is = $1.00 \n" ;
    cout << " Enter Q or q for Quarer which is = $0.25 \n";
    cout << " Enter M or m for Dime which is = $0.10 \n";
    cout << " Enter N or n for Nickle whihc is = $0.50 \n";
    cout << " Enter X or x to stop \n\n";


    cout << " It cost $3.50 for a deep-fried twinkie. \n";
    cout  << " Your have inserted: $"<< moneyEnter << "." << endl;
    cout << " Insert amount ( enter letter of choice ):  " <<endl;
    cin >> choice;


     if (choice == 'D' || choice == 'd')
    {
        moneyEnter = moneyEnter + DOLLAR;
    }
    else if ( choice == 'Q' || choice == 'q')
    {
       moneyEnter += QUARTER;
    }

    else if (choice == 'M' || choice == 'm')
    {
        moneyEnter +=DIME;
    }
    else if (choice == 'N' || choice == 'n')
    {
        moneyEnter +=NICKEL;
    }
    else if (choice == 'X' || choice == 'x')
    {
        cout << "Stop \n";
    }
    else 
    {
        "Invalid Input \n";
    }

    return 0;
}
Be a part of the DaniWeb community

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