Question: How do I get my function to print from elements.txt ( or any text file ) using pointers const char * classString; switch ( classChoice
How do I get my function to print from elements.txt or any text file using pointers const char classString;
switch classChoice
case : classString "alkali metals"; break;
case : classString "metalloids"; break;
case : classString "alkaline earth metals"; break;
case : classString "reactive nonmetals"; break;
case : classString "transition metals"; break;
case : classString "noble gases"; break;
case : classString "posttransition metals"; break;
case : classString "lanthanides"; break;
case : classString "actinides"; break;
case : classString "unknown properties"; break;
default:
printfInvalid class choice.
;
return;
FILE file fopenelementstxtr;
if file NULL
printfError opening file.
;
return;
element tempElement;
while fscanffiled s s s lf &tempElement.num, tempElement.name, tempElement.symbol, tempElement.elementClass, &tempElement.atomicWeight
if strcmptempElementelementClass, classString
printfd s s s lf
tempElement.num, tempElement.name, tempElement.symbol,
tempElement.elementClass, tempElement.atomicWeight;
fclosefile; This the code I working with for reference
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
