Be gentle ... I'm 5 weeks into studying C++. I've dug and dug and cannot figure out why Visual Studio Express (and online compilers) are throwing errors about this.
Note that I've included all my declarations for the sake of clarity -- most are used in different section of code. The line that gets the errors is this one: newsharePrice = perchangeEnd * profitLoss << '\n';
The error I get is c2296, left operand has type double. I have no idea why it doesn't like this ... I multiply other doubles just fine.
double numberShares, sharePrice, profitLoss, profitGain, commissionPaid, commissionCost, sharesCost, totalshareCost, newtotalshareCost, newcommissionCost, newsharePrice; double perChange; double perchangeEnd; const int minVALUE = 1; const int maxVALUE = 100; int seed = time(0); srand (seed); perChange = (rand() % (maxVALUE - minVALUE + 1)) + minVALUE; cout << perChange << '\n'; perchangeEnd = perChange / 100; int flip = rand() % 2 + 1; if (flip == 1) profitLoss = 1; else profitLoss = -1; newsharePrice = perchangeEnd * profitLoss << '\n'; newsharePrice = newsharePrice + sharePrice; cout << newsharePrice << '\n'; newtotalshareCost = numberShares * newsharePrice; cout << "You've now paid " << newtotalshareCost << " for your shares." << '\n'; newcommissionCost = newtotalshareCost * commissionRate; cout << "The new amount of commission for this is " << newcommissionCost << " ." << '/n';
<< '\n'.