I’m pretty new to C so if you think i’m going about this completely wrong, please tell me so. I’ve looked through multiple tutorial sites, but im still not certain how i need to go about this. Basically what I am trying to do is create a periodic table program for the command line, first it draws a text only periodic table, then it asks the user to input the chemical symbol an element. What im wanting it to do is after it gets the input, is to go to a part in the program and print information about the element to the terminal. I just don’t know how to compare the strings, to the preset element symbols. I was thinking i would have to use either a If stament or switches? is there any way to do this, or am i taking the wrong approach? I’m sorry if i don’t make much sense right now.
Edit – I figgured out how to do what i was needing to do, so i’ll post a simple version of what a came up with. And i should probably give credit to http://www.cprogramming.com/ for the function to remove the null terminator.
#include <stdio .h><br />
#include <stdlib .h><br />
#include <strings .h><br />
/* remove the null terminator */<br/>
/* we're done, so just exit the function by returning */<br/>
/* return; */<br/>
/* if we get all the way to here, there must not have been a newline! */<br/>
printf("Please enter Chemical Symbol ");<br/>
/* see definition above */<br/>
/* strcmp returns zero when the two strings are equal */<br/>