Answered step by step
Verified Expert Solution
Question
1 Approved Answer
For this lab, you will implement a program that can output information about any element in the periodic table of elements. Requirements Read in a
For this lab, you will implement a program that can output information about any element in the periodic table of elements. Requirements Read in a comma-separated values text file that contains the information about the elements in the periodic table. Save those elenments in a data structure for further processing. Accept command-line parameters: o Program arguments shall be the chemical symbols for wish the user wants more information o Optionally, the user may provide as the first program argument. the name of a file to write the information out to Print out, or write to a file, information about the elements requested Data structure for elements You will need to declare a data structure to hold the information about the chemical element Your structure will have the following components Atomic Number (integer) Chemical Symbol (string) Name (string) Atomic Weight (floating point number State at room temp (string) Bonding type (string Year discovered (string) Incomplete Sample Code You can download an incomplete sample code, though you don't have to completely follow it incomplete sample code. Read in file First, download the element database file by clicking here elemen cs. Save this file in the same directory as the source code for your lab. The first thing your program should do is read in the element db.csv file. line by line. Every line of the file represents one element in the periodic table of elements. o Open the .csv file for reading a text file. and read in every line of the file using the function fgets. o The file in csv format. which means the data fields are separated by commas. Use the function strtok to extract the data field by field. o You can use the function atoito convert a string to an integer. o The function atof can be used to convert a string to a floating point number. Save all of the elements scanned in into an array for further processing
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