A very simple program that I wrote using C++ to demonstrate the use of setprecision function in iomanip library of C++ and to show very basic inventory system written in C++ I use this example in my C++ programming class here in my hometown in Bacolod City, Negros Occidental Philippines. What does the program will do is to ask the user the product name, individual product cost, quantity of the product and then our program will compute the total cost of the product.
I am currently accepting programming work, it project, school
programming projects , thesis and capstone projects, IT consulting
work, computer tutorials and web development work kindly contact me in the following email address for further details. If you want to advertise in my website kindly contact me also in my email address also. Thank you.
My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
My mobile number here in the Philippines is 09173084360.
My telephone number at home here in Bacolod City, Negros Occidental Philippines is +63 (034) 4335675.
Sample Program Output
Program Listing
inventory.cpp
#include <iostream>
#include <iomanip>
#include <stdlib.h>
using namespace std;
int main()
{
string product;
float price=0.00;
int quantity=0;
float total_cost=0.00;
cout << "Simple Product Information System";
cout << "\n\n";
setprecision(2);
cout << "Give Product Name : ";
getline(cin,product);
cout << "Product Price : ";
cin >> price;
cout << "Product Quantity : ";
cin >> quantity;
total_cost = (price * quantity);
cout << "\n\n";
cout << "===== Display Report =====";
cout << "\n\n";
cout << "Product Name : " << product << "\n";
cout << "Product Price : PHP " << price << "\n";
cout << "Quantity : " << quantity << "\n";
cout << "\n\n";
cout << "Total Cost : PHP " << total_cost;
cout << "\n\n";
cout << "End of Program";
cout << "\n\n";
system("pause");
}
No comments:
Post a Comment