Question #46763

write a program in c++ that accepts the name of a product from the user and displays the price of the product of the product to the screen.The product available are
1.Dell D600 price =200 GH
2.Compaq Hp price =500 GH
3.Lenovo G500 price = 1200 GH

Expert's answer

Solution:
CODE (C++)

#include<iostream>
#include<string>

using namespace std;

int main() {
// Nameoutput/input
string name;
cout << "The product name: ";
getline(cin, name);

// Priceoutput
if (name == "Dell D600") {
cout << "The product price is 200 GH.";
}
if (name == "Compaq Hp") {
cout << "The product price is 500 GH.";
}
if (name == "Lenovo G500") {
cout << "The product price is 1200 GH.";
}

return 0;
}
LATEST TUTORIALS
APPROVED BY CLIENTS