Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 stellarinformation.c here, or copy it to your CSE account using the following command:
cp n importreedAdppublichtmlTactivitiesstellarinformationstellarinformation.c
Write a C program stellarinformation.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 lightyears 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
Define a structure named star with the following fields:
name: a string of size to store the star's name.
distance: a double to store the star's distance from Earth in lightyears.
spectraltype: a character to store the star's spectral type eg O B A F G K M
Task
Declare a pointer starptr to a star structure.
Task
Write the function called inputstarinformation 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started