I'm making a code that will recieve the dimensions for four rooms and then add them together and give me variable totalSqFeet. I have to use a for loop to achive this and idk how to take the separate values from each room. It's hard to explain here is the coding i have so far any help?
if ( width < 10 || width > 50 )
{
cout << " \n Width is not between 10 and 50 " ;
width = 0 ;
}
if ( length < 10 || length > 50 )
{
cout << " \n Length is not between 10 and 50 " ;
length = 0 ;
}
Firstly, your input validation for the length and width just poses the question whether they are within the constraints, what you should do is use a while loop.. Like this
1 2 3 4 5
While ( length < 10 || length > 50 )
{
cout << "Length is not ... blah blah";
cin >> length;
}
You we're on the right track, but you want to make sure that you still get the Input from them despite that they entered a wrong number.