0
Why this simple code doesn't work?
#include <iostream> using namespace std; int main() { double length = 5.6; double height = 3.1; double area = lenght * height; cout<< area; }
2 Réponses
+ 8
You have defined length and height as variables, but you are using lenght in the area calculation.
Change the line double area = lenght * height; to double area = length * height; and the code should work as expected.
https://code.sololearn.com/cGwrcr7ljw2j/?ref=app
0
You have length misspelled in your area assignment. Don't forget to check error logs, sometimes they can be useful (and at times confusing haha). ;)