1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
den301095 [7]
3 years ago
12

Hello, please help write code in C++. Primary U.S. interstate highways are numbered 1-99. Odd numbers (like the 5 or 95) go nort

h/south, and evens (like the 10 90) go east/west. Auxiliary highways are numbered 100-999, and service the primary highway indicated by the rightmost two-digits. Thus, the 405 services the 5, and the 290 services the 90. Given a highway number, indicate whether it is a primary or auxiliary highway. If auxiliary, indicate what primary highway it serves. Also indicate if the (primary) highway runs north/south or east/west. If the input is 90, the output is: The 90 is primary, going east/west. If the input is 290, the output is: The 290 is auxiliary, serving the 90, going east/west. If the input is not 1-999 such as 0, the output is: 0 is not a valid interstate highway number.
Computers and Technology
1 answer:
krok68 [10]3 years ago
3 0

Answer:

Please Find attached  c++ code file.

Explanation:

  1. Ask User to enter highway number.
  2. Check if highway is primary or auxiliary.
  3. Check if highway number is even / odd.
  4. Find Primary high number for an auxiliary highway

Check if highway is primary or auxiliary.

Use if condition to check if the entered number is in between 0 and 99.If it's true than the highway is primary otherwise it's an auxiliary highway.

Check if highway number is even / odd.

To check if a number is even or odd we use simple modulo formula. In mathematics modulo returns the reminder of a division operation on two numbers.If modulo of a number and 2 is equal to zero than that number is an even number other wise its an odd number.

(Any number ) mod 2 = 0

Find Primary high number for an auxiliary highway

As mentioned in the question last two digits of highway number is the number of primary high.

To Find last two digits of number apply modulo operation on highway number and 100. it will provide last two digits of number specifying our primary highway.

Download cpp
You might be interested in
WRITE A PROGRAM TO CALCULATE SIMPLE INTEREST
Alchen [17]

The simple interset program is a sequential program, and does not require loops and conditions

The simple interset program in Python, where comments are used to explain each line is as follows:

#This gets input for the principal amount

P = int(input("P = "))

#This gets input for the rate

R = int(input("R = "))

#This gets input for the number of years

N = int(input("N = "))

#This calculates the simple interest

I = P * R * T * 0.01

#This prints the simple interest

print("Simple Interest =",I)

Read more about simple interest at:

brainly.com/question/2294792

7 0
2 years ago
Your computer uses 4 bits to represent decimal numbers (0, 1, 2, 3 and so on) in binary. What is the SMALLEST number for which a
natali 33 [55]
2 I think because 2 I think is binary I’m sorry if this is wrong
8 0
2 years ago
What output is produced by the following code? Integer first = new Integer(7); Integer second = first; if (first == second) Syst
fenix001 [56]

Answer:

The correct output of this question is  "Sneezy Sleepy".

Explanation:

In the given code firstly we create the object of the integer class that is first in this we pass the integer value that is 7. Then we declare another second integer variable is this variable we pass object as a reference. Then we use the two conditional statements. In the first, if block we check that the object of the class is equal to the reference variable. If it is true it prints Sneezy. otherwise, it will print Grumpy. In second if block we check that the object of the class is equal to the reference variable. but in this time we the equals() function it is the same as(==). If the condition is true it prints Sleepy. otherwise, it will print Doc. So the output of the code is Sneezy Sleepy.

6 0
3 years ago
What are basic difference between variable and data type in the c? ​
OLga [1]

Answer:

there is lot of difference

7 0
2 years ago
What is the process called that determines how bits are represented on the medium?
Bad White [126]
The process that determines how bits are represented on the medium is called encoding. It is the process of converting a certain data into a particular format that is required for a certain processing need like program execution, data transmission or file conversion.
3 0
3 years ago
Other questions:
  • What will be returned when the following SQL statement is executed?
    5·2 answers
  • What process improves the life of a computer
    11·1 answer
  • Which of the following statements is true?
    12·1 answer
  • what type of clause must you always use with DEKETE or UPDATE to avoid inadvertently changing data elsewhere in the database​
    12·1 answer
  • How to solve 3(x - 2) = 9x<br><img src="https://tex.z-dn.net/?f=3%28x%20-%202%29%20%3D%209x" id="TexFormula1" title="3(x - 2) =
    14·1 answer
  • Quinton is having trouble learning Spanish because he keeps reverting back to the grammatical structures of his native English l
    6·1 answer
  • __________ are the first line of defense against unsafe drivers.
    5·1 answer
  • The seven basic parts of a computer are
    10·2 answers
  • You want to calculate a bonus if the sold price was at least equal to the listing price, and if the house sold within 30 days af
    6·1 answer
  • A document commonly used in real estate transactions, detailing the fees, commissions, insurance, etc. that must be transacted f
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!