double typedata error

anyone knows why this happened?

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
#include <iostream>

int main() {
	int u_input = 0;
	double u_tax = 0.0;
	double total = 0.0;
	while (1) {
		std::cout << "enter price: ";
		std::cin >> u_input;
		std::cout << "enter tax: ";
		std::cin >> u_tax;

		if ((u_input > 0) && (u_tax > 0 && u_tax <= 100))
			break;
		std::cout << "enter the correct value!" << std::endl;
	}
	u_tax = u_tax / 100;
	total = u_input + (u_input * u_tax);

	if (total % 100 != 0) {
		u_tax = total + (100 - (total % 100));
			std::cout << u_tax << std::endl;
	}
	std::cout << "press any key to continue...";
	std::cin.get();
	return 0;
}


error msg:

Severity Code Description Project File Line Suppression State
Error (active) E2140 expression must have integral or unscoped enum type test_cpp d:\...\test_cpp.cpp 20
Severity Code Description Project File Line Suppression State
Error (active) E2140 expression must have integral or unscoped enum type test_cpp d:\...\test_cpp.cpp 21
solved: thx to NewtoThis on #cplusplus.com

the cause: % operator can't be used with double
Topic archived. No new replies allowed.