Answered step by step
Verified Expert Solution
Question
1 Approved Answer
You are to write a program that will scan in data about elements from the periodic table of elements. and print that data back out
You are to write a program that will scan in data about elements from the periodic table of elements. and print that data back out in a nicely formatted way. Define a structure type element t to represent one element from the periodic table of elements. Components should include: Atomic number (integer) Name (string) Chemical Symbol (string) Class (string) Atomic weight (decimal number) Number of electrons in each shell (seven-element array of imtegers) Implement functions to manipulate this element type: scan element Scans in data from keyboard input to populate an instance of an element t structure. print element Prints out the information about the element. Program Details Define a constant called MAX ELEM TS with a value of 20, and an array of element t tructures of that length. Your program must accept a single command-line argument, which is the number of elements that are to be input using the keyboard. If the user does not provide the correct number of arguments, the program must print this error message and exit: ERROR: You must provide exactly one argument to this program Convertthis argument to an integer and check that the value provided is greater than 0 and less than MAXLELEMENTS. NOTE: See Lab S for an example of how to convert the input argument to an integer. If the number is less than or equal to zero, the program must print this error message and exit. ERROR: You must provide an integer Ereater than 0 and less than or equal to 20 If the user has provided a walid number, call scan element that many times, and store each scanned structure in the array of element t tructures. Once all of the structures have been scanned in. do the following Print out the total number of elements scanned in Print out the name of the element with the smallest atomic number Print out the name of the element with the largest atomic number
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