Im new to c++ and ive been working on this assignment but my math always comes out horribly wrong. Ive followed the instructions from the book step by step but i still seem to be missing something... why is my math off so much?
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
Yeah... um... you need to add a decimal point and at least one zero to all the constant integers in that program (1 becomes 1.0, 12 becomes 12.0, etc) except the ones in setw(), else chaos will ensue.
Give hierarchy with use of parenthesis but Albatross made a good point. Integer divided by integer will give you an integer value. Integer divided by a real number will give you a real number.
I haven't compiled the program but see if that works.