Math not working

Whenever I print the tables, its only showing the first two digits of the answers. I know some of the syntax might not be what is considered best (like system("PAUSE")) but that's what my professor told us to use. I also know that not all of the variables are used, I haven't finished the program because the math from the table isn't working. Basically, I want to know why
price = 33,520;
price = price - 11,160;
outputs 22 into the table. I assume that it is only outputting the first 2 numbers of the answer. I stored price as a long int and a double and neither worked. Thanks for any help.

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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
  #include <iostream>
#include <string>
#include <cmath>

using namespace std;

int main (int argc)
{
	int type;
	int vehicleType;
	int passengerCar;
	int truckVan;
	int newlyPurchased;
	long int yearPurchased;
	long int day;
	int electric;
	int choice;
	long int year;
	long long int VIN;
	long long int price;
	long long int depreciationYear = 2013;	
	string makemodelcolor;
	string month;
	

	cout << "Car Depreciation Values For Epona's Estranged Earrings\n\n";
	cout << "What year was this vehicle purchased?\n\n";
	cin >> yearPurchased;

	if (yearPurchased != 2013)
	{
		cout << "I'm sorry, but this program only works for vehicles purchased in 2013.\n\n";
		system("PAUSE");
		return 0;
	}
	

	cout << "Hello, what kind of car would you like to calculate the depreciation of? Please enter its repsective number.\n\n";
	cout <<"Please select the vehicle: \n\n" 
		"1) Passenger Car: (new) 2013 Volvo C70 $41,200 \n" 
		"2) Passenger Car: (Used) 2012 Nissan Versa S $13,892 \n"  
		"3) SUV:  (New) 2014 Honda Pilot  $33,520 \n"  
		"4) Truck: (New) 2015 Chevrolet Truck Silverado 3500HD Crew Cab 4WD $41,045 \n"  
		"5) Van: (Used) 2011 Honda Odyssey EX $27,900 \n"
		"6) Other Truck/Van (You will have to enter values manually) \n"
		"7) Other Passenger Car (You will have to enter values manually) \n";
	cin >> choice;
	
	if (choice == 1)
	{
		price = 41,200;
		cout << "What is the car's VIN number?\n";
		cin >> VIN;
		cout << "In which month did you purchase this car?\n";
		cin >> month;
		cout << "On which day of that month did you purchase this car?\n\n";
		cin >> day;
		cout << "Report for Epona's Estranged Earrings. \n 2013 Volvo C70: White, " << VIN << ", new, purchased " << month << " " << day << ". 2013.\n\n";
		cout << "______________________________________________\n";
		cout << "|   Tax Year   | Max Depreciation | New Value |\n";
		cout << "|---------------------------------------------|\n";

		price = price - 11,160;
		cout << "| " << depreciationYear << " |      11,160        | " << price << " |\n";
		cout << "|---------------------------------------------|\n";

		depreciationYear = depreciationYear + 1;
		price = price - 5,100;
		cout << "| " <<depreciationYear << " |       5,100         | " << price << " |\n";
		cout << "|---------------------------------------------|\n";

		depreciationYear = depreciationYear + 1;
		price = price - 3,050;
		cout << "| " <<depreciationYear << " |       3,050         | " << price << " |\n";
		cout << "|---------------------------------------------|\n";
		


		do 
		{
		depreciationYear = depreciationYear + 1;
		price = price - 1,875;
		cout << "| " <<depreciationYear << " |       1,875         | " << price << " |"<< endl;
		cout << "|---------------------------------------------|\n";
		}
		while (price >= 1);
	}
	
	else if (choice == 2)
	{
		price = 13,892;
		cout << "What is the car's VIN number?\n";
		cin >> VIN;
		cout << "In which month did you purchase this car?\n";
		cin >> month;
		cout << "On which day of that month did you purchase this car?\n\n";
		cin >> day;
		cout << "Report for Epona's Estranged Earrings. \n 2012 Nissan Versa S: Silver, " << VIN << ", used, purchased " << month << " " << day << ". 2013.\n\n";
		cout << "______________________________________________\n";
		cout << "|   Tax Year   | Max Depreciation | New Value |\n";
		cout << "|---------------------------------------------|\n";

		price = price - 11,160;
		cout << "| " << depreciationYear << " |         11,160           |     " << price << "     |\n";
		cout << "|---------------------------------------------|\n";

		depreciationYear = depreciationYear + 1;
		price = price - 5,100;
		cout << "| " <<depreciationYear << " |        5,100             |     " << price << "    |\n";
		cout << "|---------------------------------------------|\n";
	
	}
	else if (choice == 3)
	{
		price = 33,520;
		cout << "What is the car's VIN number?\n";
		cin >> VIN;
		cout << "In which month did you purchase this car?\n";
		cin >> month;
		cout << "On which day of that month did you purchase this car?\n\n";
		cin >> day;
		cout << "Report for Epona's Estranged Earrings. \n 2014 Honda Pilot: White, " << VIN << ", used, purchased " << month << " " << day << ". 2013.\n\n";
		cout << "______________________________________________\n";
		cout << "|   Tax Year   | Max Depreciation | New Value |\n";
		cout << "|---------------------------------------------|\n";

		price = price - 11,160;
		cout << "| " << depreciationYear << " |      11,160        | " << price << " |\n";
		cout << "|---------------------------------------------|\n";

		depreciationYear = depreciationYear + 1;
		price = price - 5,100;
		cout << "| " <<depreciationYear << " |       5,100         | " << price << " |\n";
		cout << "|---------------------------------------------|\n";

		depreciationYear = depreciationYear + 1;
		price = price - 3,050;
		cout << "| " <<depreciationYear << " |       3,050         | " << price << " |\n";
		cout << "|---------------------------------------------|\n";
		


		do 
		{
		depreciationYear = depreciationYear + 1;
		price = price - 1,875;
		cout << "| " <<depreciationYear << " |       1,875         | " << price << " |"<< endl;
		cout << "|---------------------------------------------|\n";
		}
		while (price >= 1);
	}
	else if (choice == 4)
	{
	}
	else if (choice == 5)
	{
	}
	else if (choice == 6)
	{
		vehicleType = truckVan;
	}
	else if (choice == 7)
	{
		vehicleType = passengerCar;
	}
	else
	{
			cout << "Please enter 1, 2, 3, 4, 5, 6, or 7 to select a vehicle.\n\n";
	}	
        system("PAUSE");
	return 0;
}
Floating-points are separated with periods (.) not commas (,) also an integer is well an integer not a floating-point (double). So you you must change the data type.

http://www.cplusplus.com/doc/tutorial/variables/
Are you saying I should make it a double? I don't fully understand. It isn't a decimal.

OH, no comma at all maybe? That would make sense. I'm dumb, commas are just for human pronunciation... You thought I meant 11.160, I meant 11 thousand. My mistake.
Last edited on
Conclusion: I was dumb and should feel dumb. It works when I take the commas out of the numbers. Problems with coding late at night! thanks, anyone who read.
Topic archived. No new replies allowed.