Calculating total based on the given quantity and price in C++
By: Jeffrey
This simple C++ program shows how to calculate total based on the given quantity and price.
#include <iostream>
using namespace std;
// main() function with no argument and int return value…
int main(void)
{
// variables declaration and their respective the data types
int quantity;
float price, total;
cout<<"testing 1..2..3..\n";
// standard output - read from user input
cout<<"\nEnter the item's price: RM ";
// standard input - store user's input at variable price
cin>>price;
cout<<"\nEnter the item's quantity: ";
cin>>quantity;
// multiply quantity and price store the result at total…
total = quantity * price;
// print the total value
cout<<"\nTotal price = RM "<<total<<endl;
return 0;
}
Archived Comments
1. Great looking website. Presume you did a lot of your very own html coding.
[u
View Tutorial By: http://www.votretherapie.us at 2017-05-29 09:16:48
Comment on this tutorial
- Data Science
- Android
- AJAX
- ASP.net
- C
- C++
- C#
- Cocoa
- Cloud Computing
- HTML5
- Java
- Javascript
- JSF
- JSP
- J2ME
- Java Beans
- EJB
- JDBC
- Linux
- Mac OS X
- iPhone
- MySQL
- Office 365
- Perl
- PHP
- Python
- Ruby
- VB.net
- Hibernate
- Struts
- SAP
- Trends
- Tech Reviews
- WebServices
- XML
- Certification
- Interview
categories
Related Tutorials
Calculating total based on the given quantity and price in C++
Sorting an array of Strings in C++
Matrix using nested for loops in C++
Compute the square root of the sum of the squares of an array in C++
Calculate average using Two-Dimensional Array in C++
Two-Dimensional Array Manipulation in C++
Compiling and Linking Multiple Source Files in C++
Escape Sequences for Nonprintable Characters in C++
Using the Built-in Arithmetic Types in C++