Need help please

Hello, community:
I have a problem an I need some assistance. I have a programming homework assignment that is a simple Distance = Rate * Time, with some conditions the speed of the vehicle must have a parameter between 10 - 120 mph and time cannot hold a negative value or surpass 24 hours.

my code is:
P.S. My compiler is Visual Studio 17 community.
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//Distance Traveled
//The distance a vehicle travels can be calculated as follows : “distance = speed * time”.
//the car travels 40 miles per hour for 3 hours, the distance traveled is 120 miles.
//Write a program that asks the user for the speed of a vehicle(in miles per hour) and how many hours it has traveled.
//The program should display the distance the vehicle has traveled for each hour of that time.
//For input validation, Must not accept values x <= 10 or x => 120 for speed and  x <= 1 or => 24 for time. Use “int” declarations.*/
/**********************************************************************************************************************************/
//Create By: J L

#include "pch.h"
#include <iostream>
using namespace std;
int main()
{
	int distance, speed, time; //Line 15 declaring variables and using int.

	cout << "How fast is the vechicle traveling please enter positive natural numbers from \"10 - 120\"?\n";
	cin >> speed;
	while (speed < 10 && speed > 120)
	{		
		cout << "Sorry thats a incorrect values please enter a new value:\n";
		cin >> speed;

	}
	cout << "How long has the vehicle been traveling please enter positive natural numbers from \"1 - 24\"?\n";
	cin >> time;
	while (time < 1 && time >24)
	{
		cout << "Sorry thats a incorrect value please enter a new value:\n";
		cin >> time;
	}

	

	cout << "\n\nThe speed you have entered is: " << speed << " miles-per-hour.\n";
	cout << "\nThe time you have entered is: " << time << " hours.\n\n";

	cout << "Hours\tDistance Traveled\n";
	cout << "-----" << "\t" << "-----------------\n";
	for (int i = 1; i<=time; i++)
	{
		distance = speed * i;
		cout << i << "\t\t" << distance << endl;
	}

	return 0;
}


so my issue is when I use my while statement to set the speed for values of 10 - 120 to loop itself if the value is less than 10 or greater than 120. It doesn't loop as directed. The same thing goes for the Time variable please any assistance will be greatly appreciated. Furthermore, I apologize in advance for posting in the wrong section of the forums for assistance.

hey,
there is problem with the while statement, it should be
while (speed > 10 && speed > 120)

there is same problem here
time > 1 && time >24
I have changed my inequalities, but it still won't execute correctly. Meaning that it won't loop if I try to enter a lesser value then 10
You should be using OR ( || ), not AND ( && ) in both of lines 19 and 27.
Fixed it guy's. Thank you for your help.
Topic archived. No new replies allowed.