Having trouble with this class

Won't compile the following is the input file. I'm sure I'm missing some stupid. Please help.
Stocks.txt

ABC 123.45 130.95 132.00 125.00 120.50 8.67% 10000
AOLK 80.00 75.00 82.00 74.00 83.00 -9.64% 5000
CSCO 100.00 102.00 105.00 98.00 101.00 0.99% 25000
IBD 68.00 71.00 72.00 67.00 75.00 -5.33% 15000
MSET 120.00 140.00 145.00 140.00 115.00 21.74% 30920

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
  // Kenneth Clark

#include <iostream>
#include <fstream>
#include <cstdlib>
#include <iomanip>
using namespace std;

class stockType
{
public:
       void setStock (char, double, double, double, double, double, double);
       void getStock (char&, double&, double&, double&, double&, double&, double&)const;
       void printStock() const;
       void inputStock (char, double, double, double, double, double, double);
       void showPriceDiff();
       void calcPercentGain();
       void showShares(); 
       stockType(char, double, double, double, double, double, double);
       stockType();
private:
        char ss;
        double op, cp, th, tl, pc, sv;  
};

void stockType::setStock (char symbol, double openingPrice, double closingPrice, 
double todayHigh, double todayLow, double prevClose, double volume)
{
      if ('A' <= symbol && symbol < 'z') 
      ss = symbol; else ss = ' '; 
      if (0 <= openingPrice && openingPrice < 9999) 
      op = openingPrice; 
      else op = 0; 
      if (0 <= closingPrice && closingPrice < 9999) 
      cp = closingPrice; 
      else cp = 0;
      if (0 <= todayHigh && todayHigh < 9999)
      th = todayHigh;
      else th = 0;
      if (0 <= todayLow && todayLow < 9999)
      tl = todayLow;
      else tl = 0;
      if (0 <= prevClose & prevClose < 9999)
      pc = prevClose;
      else pc = 0;
      if (0 <= volume && volume < 999999)
      sv = volume;
      else sv = 0;
}
void stockType::getStock(char& symbol, double& openingPrice, double& closingPrice, 
double& todayHigh, double& todayLow, double& prevClose, double& volume) const 
{ 
     symbol = ss; openingPrice = op; closingPrice = cp; todayHigh = th;
     todayLow = tl; prevClose = pc; volume = sv;
}
void stockType::printStock() const 
{ 
     if (ss < 'A') cout << " ";
     cout << ss; 
     if (op < 10) cout << "0"; 
     cout << op;
     if (cp < 10) cout << "0"; 
     cout << cp;
     if (th < 10) cout << "0";
     cout << th;
     if (tl < 10) cout << "0";
     cout << tl;
     if (pc < 10) cout << "0";
     cout << pc;
     if (sv < 10) cout << "0";
     cout << sv; 
} 
void stockType::inputStock (char symbol, double openingPrice, double closingPrice, 
double todayHigh, double todayLow, double prevClose, double volume)
{ 
ifstream inFile; 
inFile.open("Stocks.txt"); 
inFile >> symbol;
inFile >> openingPrice >> closingPrice >> todayHigh >> todayLow >> prevClose >> volume;
inFile.close(); 
}
void stockType::showPriceDiff()// Nichole Knowles*****************************************
{                                                                                      //*
cout << "Today's opening price was " << op << ", and the closing was " << cp << endl;  //*
cout << "Today's high price was " << th << ", and the low price was " << tl << endl;   //*
cout << "While the previous closing price was " << pc << endl;                         //*
}                                                                                      //*
void stockType::calcPercentGain()                                                      //*
{                                                                                      //*
return (cp - pc) / pc * 100;                                                           //*
} // Nichole Knowles**********************************************************************
void stockType::showShares()
{
return sv;     
}     
stockType::stockType(char symbol, double openingPrice, double closingPrice, 
double todayHigh, double todayLow, double prevClose, double volume)
{
      if ('A' <= symbol && symbol < 'z') 
      ss = symbol; else ss = ' '; 
      if (0 <= openingPrice && openingPrice < 9999) 
      op = openingPrice; 
      else op = 0; 
      if (0 <= closingPrice && closingPrice < 9999) 
      cp = closingPrice; 
      else cp = 0;
      if (0 <= todayHigh && todayHigh < 9999)
      th = todayHigh;
      else th = 0;
      if (0 <= todayLow && todayLow < 9999)
      tl = todayLow;
      else tl = 0;
      if (0 <= prevClose & prevClose < 9999)
      pc = prevClose;
      else pc = 0;
      if (0 <= volume && volume < 999999)
      sv = volume;
      else sv = 0;
}
stockType::stockType() 
{ 
    ss = ' '; 
    op = 0; 
    cp = 0;
    th = 0;
    tl = 0;
    pc = 0;
    sv = 0; 
};





int main()
{
 
 
 
 system ("pause");
 return 0;    
}   
The stupid thing hangs at lines 90 and 94.
A function that has been defined to return nothing (void) can not return a value.

OK, made this change, still not getting through here's what I changed.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
class stockType
{
public:
       void setStock (char, double, double, double, double, double, double);
       void getStock (char&, double&, double&, double&, double&, double&, double&)const;
       void printStock() const;
       void inputStock (char, double, double, double, double, double, double);
       void showPriceDiff();
       void calcPercentGain();
       void showShares(); 
       stockType(char, double, double, double, double, double, double);
       stockType();
private:
        char ss;
        double op, cp, th, tl, pc, sv;  
};

void stockType::setStock (char symbol, double openingPrice, double closingPrice, 
double todayHigh, double todayLow, double prevClose, double volume)
{
      if ('A' <= symbol && symbol < 'z') 
      ss = symbol; else ss = ' '; 
      if (0 <= openingPrice && openingPrice < 9999) 
      op = openingPrice; 
      else op = 0; 
      if (0 <= closingPrice && closingPrice < 9999) 
      cp = closingPrice; 
      else cp = 0;
      if (0 <= todayHigh && todayHigh < 9999)
      th = todayHigh;
      else th = 0;
      if (0 <= todayLow && todayLow < 9999)
      tl = todayLow;
      else tl = 0;
      if (0 <= prevClose & prevClose < 9999)
      pc = prevClose;
      else pc = 0;
      if (0 <= volume && volume < 999999)
      sv = volume;
      else sv = 0;
}
void stockType::getStock(char& symbol, double& openingPrice, double& closingPrice, 
double& todayHigh, double& todayLow, double& prevClose, double& volume) const 
{ 
     symbol = ss; openingPrice = op; closingPrice = cp; todayHigh = th;
     todayLow = tl; prevClose = pc; volume = sv;
}
void stockType::printStock() const 
{ 
     if (ss < 'A') cout << " ";
     cout << ss; 
     if (op < 10) cout << "0"; 
     cout << op;
     if (cp < 10) cout << "0"; 
     cout << cp;
     if (th < 10) cout << "0";
     cout << th;
     if (tl < 10) cout << "0";
     cout << tl;
     if (pc < 10) cout << "0";
     cout << pc;
     if (sv < 10) cout << "0";
     cout << sv; 
} 
void stockType::inputStock (char symbol, double openingPrice, double closingPrice, 
double todayHigh, double todayLow, double prevClose, double volume)
{ 
ifstream inFile; 
inFile.open("Stocks.txt"); 
inFile >> symbol;
inFile >> openingPrice >> closingPrice >> todayHigh >> todayLow >> prevClose >> volume;
inFile.close(); 
}
void stockType::showPriceDiff()// Nichole Knowles*****************************************
{                                                                                      //*
cout << "Today's opening price was " << op << ", and the closing was " << cp << endl;  //*
cout << "Today's high price was " << th << ", and the low price was " << tl << endl;   //*
cout << "While the previous closing price was " << pc << endl;                         //*
}                                                                                      //*
stockType::calcPercentGain()                                                           //*
{                                                                                      //*
return (cp - pc) / pc * 100;                                                           //*
} // Nichole Knowles**********************************************************************
stockType::showShares()
{
return sv;     
}     
stockType::stockType(char symbol, double openingPrice, double closingPrice, 
double todayHigh, double todayLow, double prevClose, double volume)
{
      if ('A' <= symbol && symbol < 'z') 
      ss = symbol; else ss = ' '; 
      if (0 <= openingPrice && openingPrice < 9999) 
      op = openingPrice; 
      else op = 0; 
      if (0 <= closingPrice && closingPrice < 9999) 
      cp = closingPrice; 
      else cp = 0;
      if (0 <= todayHigh && todayHigh < 9999)
      th = todayHigh;
      else th = 0;
      if (0 <= todayLow && todayLow < 9999)
      tl = todayLow;
      else tl = 0;
      if (0 <= prevClose & prevClose < 9999)
      pc = prevClose;
      else pc = 0;
      if (0 <= volume && volume < 999999)
      sv = volume;
      else sv = 0;
}
stockType::stockType() 
{ 
    ss = ' '; 
    op = 0; 
    cp = 0;
    th = 0;
    tl = 0;
    pc = 0;
    sv = 0; 
};
What is your compiler telling you?

Thank you for mentioning that. It is fixed now. It basically told me to put a double on the function. You guy are the best! Thanks.
Topic archived. No new replies allowed.