Question: Chemical Elements Write a program elements.c that loads the chemical elements from a file into a struct array and allows the user to search it
Chemical Elements Write a program elements.c that loads the chemical elements from a file into a struct array and allows the user to search it and edit it In the main) procedure, do the following First, declare a struct to store properties of chemical elements. Include the following members: name, symbol, atomic number, atomic mass. Define it as a type called Element using the typedef keyword. An example of the properties stored is as follows: Name: Aluminum Symbol: Al Atomic Number: 13 Atomic Mass: 26 Declare a variable (object) called element1 of type Element and initialize all its members from standard input (i.e., ask the user to enter each value) Write a function printElement() that takes an element (e.g., element1) as parameter and prints it member variables in the format above Declare another element called element Write a function initElement() that takes as parameters (1) a pointer to an element (e.g., element2) as parameter, (2) a string as the name of the element, (3) a string as the symbol of the element, (4) an integer as the atomic number (5) an integer as the atomic mass, and store the corresponding four member values into the element. Use the function initElement() to initialize its members with iron (Iron, Fe, 56, 26) After initializing each element, print it using the printElement() function
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
