What I mean this section of code to do is:
1. print basic mode selected- endline
2. print please add number to be transformed- endline
3. input to double "number"
4. double transformed = (((number - 150) /100) +1)
5. print some more text, print number, print transformed.
6. if y then starts over.
but when I compile it, it doesnt seem to be calculating transformed correctly. For example ill input 4000, and the print will be:
"The transformed number for 4000 is:
-0.5"
it should have done (((4000-150) /100) +1) which would normally = 39.5
why am I getting -0.5?
help please :) , this is my code:
Expand|Select|Wrap|Line Numbers
- #include <iostream>
- using namespace std;
- double number;
- double transformed = (((number - 150) /100)+1);
- string mode_select;
- string rebasic;
- int main() {
- basicagain:
- cout << "Basic mode selected" << endl << endl;
- cout << "Please enter number to be transformed." << endl;
- cin >> number;
- cout << endl << "The transformed number for " << number << " is:" << endl;
- cout << transformed << endl;
- cout << "Calculate another? (Y/N)" << endl;
- cin >> rebasic;
- if (rebasic == "y" || rebasic == "Y") {
- goto basicagain;
- }
- }