Question #30817

Define an array of 15 CStock elements.

#include <iostream>
#include <string>
using namespace std;

class CStock
{
public:
CStock(void);
CStock(string c_symbol; string c_company, double c_price);
~CStock(void);

double getPrice();
void setPrice(double c_price);

friend istream& operator >> (istream& input, CStock& C);
friend ostream& operator << (ostream& output, CStock& C);

string symbol;
string company;

private:
double price;
};

Expert's answer

#include <iostream>
#include <string>
using namespace std;

class CStock
{
public:
CStock(void);
CStock(string& c_symbol; string c_company, double c_price);
~CStock(void);

double getPrice();
void setPrice(double c_price);

friend istream& operator >> (istream& input, CStock& C);
friend ostream& operator << (ostream& output, CStock& C);

string symbol;
string company;

private:
double price;
};

Int main () {
//define array
CStock& array[15];
//end of the program
return 0;
}
LATEST TUTORIALS
APPROVED BY CLIENTS