Question: What should the C++ code look like for this problem? 2. Next to the above two lines, write a C++ program that will define a

What should the C++ code look like for this problem? What should the C++ code look like for this problem? 2. Next

2. Next to the above two lines, write a C++ program that will define a constant named light_speed whose value is 1.86x109 miles/second. Be sure to choose the proper data type for the light_speed constant. 3. Write C++ codes to create three variables named sun, sat, and mar, and assign the distances from Sun, Saturn, and Mars to the Earth as values. The following table lists the distances. Be sure to choose the proper data type(s) for the sun, sat, and mar variables. Distance Sun to Earth Saturn to Earth Mars to Earth Value 9.3x10 miles 8.92x108 miles 1.494x108 miles Variable name Sun Sat mar 4. The number of years it takes from a planet to earth can be computed using the following formula. distant from a planet to earth number of years = value of light year 5. Write C++ codes to compute the number of years it takes to travel from Sun to Earth, from Saturn to Earth, and from Mars to Earth. Be sure to add (concatenate) string literal like Sun to earth: , Saturn to earth: , and Mars to earth: to the computed values, then display the out that looks similar to the following. G. Developer... X C:\csci123\ex2_2 Sun to earth: 500 Saturn to earth: 4795.7 Mars to earth: 803.226

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!