Question: Stellar Information Capture Download stellar _ information.c here, or copy it to your CSE account using the following command: cp - n / import /

Stellar Information Capture
Download stellar_information.c here, or copy it to your CSE account using the following command:
cp -n /import/reed/A/dp1091/public_html/24T2/activities/stellar_information/stellar_information.c .
Write a C program stellar_information.c that simulates a star system in space. Each star in the system is represented by a structure containing its name, distance from Earth (in light-years), and spectral type. Your task is to initialize a pointer to a star structure, write a function to populate its fields, a function to calculate an estimate for the time it would take to travel from earth to the star and a function to print the star's information and the estimate for the time it would take to travel from earth to the star.
Task 1
Define a structure named star with the following fields:
name: a string of size 50 to store the star's name.
distance: a double to store the star's distance from Earth in light-years.
spectral_type: a character to store the star's spectral type (e.g., O, B, A, F, G, K, M).
Task 2
Declare a pointer star_ptr to a star structure.
Task 3
Write the function called input_star_information() that prompts the user to enter the star's name, distance from Earth, and spectral type. Then store the input values in the respective fields of the struct

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!