Homework 3 - Ch 2 Programming Exercises

# Homework 3 - Ch 2 Programming Exercises - cout <<...

This preview shows page 1. Sign up to view the full content.

Tanisha Billups 9/17/08 Homework 3: Ch 2 Programming Exercises 17. STOCK COMMISSIOM /*Stock Commission By Tanisha Billups*/ #include <iostream> using namespace std; int main () { int n; // number of shares float price; // price of each share float shares; //price of shares bought float commission; // price of commission float total; // total price for stock bought cout<<” Enter the number of shares of stock bought: cin >>n;
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: cout << Enter the price per share: ; cin>>price; shares= n*price commission= .02*shares total = shares + commission cout<<The amount for the stock alone without the commission is \$ << shares << .<< endl; cout<<The amount of the commission is \$ << commission << . << endl; cout<< The total amount is \$ << total << . << endl; } return 0;...
View Full Document

## This document was uploaded on 05/01/2011.

Ask a homework question - tutors are online