Answer to Question #46763 in C++ for vincent koomson

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
1
Expert's answer
2014-09-24T03:11:20-0400
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;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS