C programming language Write a short program that asks the u
C++ programming language. Write a short program that asks the user how many balloons they wish to purchase at a cost of $2.50 per balloon. The program should display the total cost of the balloons ordered. Write the pseudo code for this program before you write the code.
Solution
Order.cpp
#include <iostream>
using namespace std;
int main()
{
int n;
cout<<\"Enter how many balloons you wish to purchase: \";
cin >> n;
double totalCost = n * 2.50;
cout<<\"The total cost of the balloons ordered: \"<<totalCost<<endl;
return 0;
}
Output:
sh-4.3$ g++ -std=c++11 -o main *.cpp
sh-4.3$ main
Enter how many balloons you wish to purchase: 10
The total cost of the balloons ordered: 25
