You own shares of 4 different companies. You need to write a program to store the following information of the stocks and then to display it. The information to be stored for each company are:
Number of shares
Unit price of the shares
Total Value of the shares of company
The' Total Value of the shares of company' should be calculated as result of Number of shares * Unit price of the shares. All these information except the The' Total Value of the shares of company' should be obtained from the user and should be stored in an array. Once the array has been populated (for all companies), print the complete information about each company and total value of stocks. Here is an example of the output.
Company Number of Shares Unit Price Total Value of the shares of company
Company A 100 10 1000
Company B 200 10.5 2100
Company C 81 20 1620
Company D 23.5 10 235
Total Value of Stocks : 4955
create an array of struct.
this is what l created but it is not building, from 25 errors l got 8 errors now, above is the question
using namespace std;
thanks all but l am still having problem building it, right now l have 8 errors from 25 errors showing.
really appreciate you guys. l would not mind if you can still help me succeed in this, this is my first shot in programming and l want to be successful
void enterCompanyName (shares shares);
void printshares (shares shars);
constint sizeOfArray = 50;
int amount; //**You will need to ask the user how many they want to enter.
//input the shares
for (int i = 0; i < amount; i++)
cin >> shares[i].Number_of_shares; // number of shares or unit price
cout << "The shares entered are: \n"
//Prints out the array of company
void printshares(shares shares)
for(int i = 0; i < i; i++)
cout << shares[i].Unit_price_of_shares;
cout << endl;