Question
Cindy uses the services of a brokerage firm to buy and sell stocks. The firm charges 1.5% service charges on the total amount for each transaction, buy or sell. When Cindy sells stocks, she would like to know if she gained or lost on a particular investment. Write a program that allows Cindy to input the number of shares sold, the purchase price of each share, and the selling price of each share. The program outputs the amount invested, the total service charges, amount gained or lost, and the amount received after selling the stock. I found the solution on this website, but I was wondering if there was a shorter way to code it. I'm a beginner of C++ so please go easy on me.
Explanation / Answer
#include #include using namespace std; main() { float in,out,temp; int i,j; printf("shares sold "); cin>>i; coutin; coutout; cout