// Write a complete C++ program that asks for the price of an item and the quantity purchased, and
// writes out the total cost.

#include <iostream>
using namespace std;
int main() {
// Declare your variables
double itemPrice, totalPrice;
int itemCount;
// Get user input for item price
cout << "What is the item price? ";
cin >> itemPrice;
// Get user input for item count
cout<< "What is the item count? ";
cin >>itemCount;
// Calculate the total price
cout<< "What is the total price? ";
cin >>totalPrice;
// Print out the total price to the user
cout << "Your items cost this much" << totalPrice;
totalPrice = itemPrice * itemCount;
return 0;
}

// Calculate the total price
cout<< "What is the total price? ";
cin >>totalPrice;

you know the item price, and the quantity of items (itemCount) the customer bought, so you can calculate the total cost by multiplying the item price times the item count, why prompt the user for total price? The program should calculate that.

if i go to a supermarket, and buy 4 cucumbers costing $1 each, the computer calculates the total cost is $4, i don’t determine to pay $2 (which is what cin >>totalPrice; is currently doing)