+ 1

How to get decimal points in my output in this case?

https://code.sololearn.com/cx73vOe9Y1e5/#cpp I want the program to give me answer in points but it is not. It is not doing so and rounding it off.

5th Feb 2018, 3:17 PM
Rajdeep Singh
Rajdeep Singh - avatar
2 Respostas
+ 9
E.g. #include <iostream> #include <iomanip> int main() { double height, base, area; std::cin >> height >> base; std::cout << std::setprecision(2) << std::fixed; std::cout << "The area of the triangle is " << base*height/2; return 0; }
5th Feb 2018, 4:23 PM
Hatsy Rei
Hatsy Rei - avatar
+ 8
Variables should be "double" or "float", not "int".
5th Feb 2018, 3:25 PM
int24h
int24h - avatar