Answer:
#include <iostream>
using namespace std;
int main()
{
int inputNumber ;
cout << "Enter an interstate highway number:";
cin >> inputNumber ;
if(inputNumber<=0 || inputNumber >= 1000)
cout << inputNumber << " is not a valid interstate highway number" << endl ;
else{
if(inputNumber > 99){
cout << "I-"<<inputNumber<< " is auxiliary, ";
int temp = inputNumber % 100 ;
cout <<"serving I-"<<temp<<", ";
if(temp%2==0){
cout << "going east/west." << endl;
}
else{
cout << "going north/south." << endl;
}
}
else{
cout << "I-"<<inputNumber<< " is primary, ";
if(inputNumber%2==0){
cout << "going east/west." << endl;
}
else{
cout << "going north/south." << endl;
}
}
}
return 0;
}
Step-by-step explanation:
- Check if input number is greater than 99, then display that the input number is auxiliary.
- Check if remainder of input number/2 is equal to 0, then display that going east/west.