63 795
Assignments Done
99,4%
Successfully Done
In August 2018

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
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;
}

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 first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions