- Declare A Boolean Variable Named Onlyvalidvalues Read In An Input Value For Variable Valcount Then Read Valcount Inte 1 (77.19 KiB) Viewed 31 times
Declare a Boolean variable named onlyValidValues. Read in an input value for variable valCount. Then, read valCount inte
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Declare a Boolean variable named onlyValidValues. Read in an input value for variable valCount. Then, read valCount inte
Declare a Boolean variable named onlyValidValues. Read in an input value for variable valCount. Then, read valCount integers from input, and output "Only valid values" if all of the integers are in the range 1000 to 2000 inclusive. Otherwise, output "Invalid value(s)". Ex: If the input is 2 1500 2020, the output is: Invalid value (s) 1 #include <iostream> 2 using namespace std; 3 4 int main() { 5 int valCount; 6 7 8 9 10 11 12 13 14 15 16} Check if (onlyValidValues) { cout << "Only valid values" << endl; } else { cout << "Invalid value(s)" << endl; } return 0; Next level 1 2