To write a C++ program that checks if an entered integer is greater than 8 and less than 10, you can use the following code:
#include <iostream>
int main() {
int number;
std::cout << "Enter an integer: ";
std::cin >> number;
if (number > 8 && number < 10) {
std::cout << "The number is greater than 8 and less than 10." << std::endl;
} else {
std::cout << "The number is not in the specified range." << std::endl;
}
return 0;
}
This program prompts the user to enter an integer, checks the condition, and prints the result accordingly.