dimanche 27 septembre 2015

Parsing a string into 2 separate integer values

been looking around and can't find an answer to my specific question. I have a static array I'm writing for a class, and the professor is requiring us to read both the index and the value to be stored on one line from the user, then storing the values in their appropriate elements. It is also a requirement to store the user's numbers as one string and convert. I'm just looking for a way to read the index, store it in one variable, and the value in another. The integers will be separated by a space. I have the code working if I have the user input the index, hit enter, and then the value. What function could I use to grab them? Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire