Question #44123
create a c++ program that will do the following:
1. ask the user to enter the names of 5 products
2. the buying and selling price of the 5 products
3. the expense of each type of product(percentage of buying price)

task- calculate the gross profit and net profit and project it
1
Expert's answer
2014-07-12T05:14:53-0400
#include <iostream>typedef struct {    std::string name;    double buiyingPrice;    double sellingPrice;    double percentage;    void calculatePercentage () {        percentage = buiyingPrice/ sellingPrice;    }} Product;int main() {    Product *array = new Product();    std::cout << "Enter information for 5 products" << std::endl;    for ( int i = 0; i < 5; i++ ) {        std::cout << "Enter name: ";        std::cin >> array[i].name;         std::cout << "Enter buiyingPrice:";         std::cin >> array[i].buiyingPrice;          std::cout << "Enter sellingPrice:";          std::cin >> array[i].sellingPrice;          array[i].calculatePercentage();          std::cout << "Percentage is " << array[i] << "%" << std::endl;    }    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!
LATEST TUTORIALS
APPROVED BY CLIENTS