[code] { your code here } [/code] |
|
|
double total,netcharge;
which makes them doubles, but your corresponding functions return ints. If a value can be a "decimal" (for example, 3.5) then that value needs to be stored in a double.PLEASE ALWAYS USE CODE TAGS (the <> formatting button), to the right of this box, when posting code. Along with the proper indenting it makes it easier to read your code and also easier to respond to your post. http://www.cplusplus.com/articles/jEywvCM9/ http://www.cplusplus.com/articles/z13hAqkS/ Hint: You can edit your post, highlight your code and press the <> formatting button. This will not automatically indent your code. That part is up to you. You can use the preview button at the bottom to see how it looks. I found the second link to be the most help. |
#include <math.h>
should be "cmath", but there is nothing in the program tat would require "cmath". For the operators (*, /, +, -) "cmath" or even "math.h" is not required.#include <string>
.
|
|
cout << "Car Type :";
. Does the program come with source code so that the user can figure out what to enter? If you want the user to enter "S", "L" or "M" then say so or you may get more than you need. Also storing this in a 2 element character array if the user enters "Sedan". The "Se" will be stored in the array, but there will be no "\0" to mark the end.type = str[0];
. Or type = std::toupper(str[0]);
to change the character to upper case if needed. The "std::toupper()" would work in other forms. This requires the header file "cctype".