#include using namespace std; /* B. Hare cmpsc 101 3.5.07 Algorithm/equation given ((NS * SP)- SC) -((NS * PP)+ PC) Breaking each value needed into its own function and out of the functions they will either return a gain or a loss. respectivly a + = gain and - = loss int main() { int = NumShares double = SalePrice double = PurchasePrice double = SaleCom double = PurchaseCom double = NetProfit double = NetLoss char for { for { cout << "What is the number of shares you have? "; cin >> NumShares; if (NumShares < 0) cout << "Number of shares must be > 0."; } for { cout << "What is the share price? "; cin >> SalePrice; if (SalePrice < 0) cout << "Sale price must be > 0."; } for { cout << "What is the sales commission rate? "; cin >> SaleCom; if (SaleCom <= 0) cout << "Sale commission must be >= 0."; } for { cout << "What is the purchase commission rate? "; cin >> PurchaseCom; if (SaleCom <= 0) cout << "Purchase commission must be >= 0."; } for { cout << "What is the purchase price? "; cin >> PurchasePrice; if (PurchasePrice < 0) cout << "Purchase price must be > 0."; } }