0
Need Help With Begginer C++ Code I have written
I have written the following code, there is more i plan to add to it FYI, however an online compiler seems to have a probelm with the first line of code it processes that and I can put in the unit but it then won’t process the rest of the code properly it just skipts straight to the end, if i take this line out the rest of the code works fone. #include <iostream> using namespace std; int main() { int m; cout << "Enter Measuring Unit (mm or metres)\n"; cin >> m; int a; cout << "Enter Hieght \n"; cin >> a; int b; cout<< "Enter width \n"; cin >> b; int area; area = a*b; cout <<area; int c; cout << "\nEnter Depth/Thickness \n"; cin >> c; int vol; vol = area*c; cout << vol; return 0; }
5 Respuestas
+ 1
First you are asking for the measuring unit.
But the code is expecting an int, not a char or string.
+ 1
Yes the int input is only for integers.
+ 1
thankyou for the help
0
sorry im not sure what this means exactly, is the ‘int’ input only for numbers, as i an determining this so that further in the code when calculating the weight i can use an if statement to choose the right value for a denisty, is there anyway you can see i can do this