Jun 3, 2010 at 7:15pm Jun 3, 2010 at 7:15pm UTC
Is there a command to check if a string exists?
I'm trying to make a database where you enter a name and it gives you the persons details.
Jun 3, 2010 at 7:17pm Jun 3, 2010 at 7:17pm UTC
How are you storing the person's details?
Jun 3, 2010 at 7:44pm Jun 3, 2010 at 7:44pm UTC
There are all kinds of find algorithms and std::string has member functions to do similar things. It really depends on what your database consists of. Even if you are using c-arrays you can still use std algorithms to find substrings or objects with particular properties.
Jun 3, 2010 at 8:05pm Jun 3, 2010 at 8:05pm UTC
Oh nevermind then I'll explore it myself when I get to algorithms. I didn't know they were needed :p
Jun 3, 2010 at 8:06pm Jun 3, 2010 at 8:06pm UTC
Comparison between strings is as easy as string == string;
, no?
-Albatross
Jun 4, 2010 at 5:13am Jun 4, 2010 at 5:13am UTC
But if I have a database of 120 persons, will i have to use 120 if's?
Jun 4, 2010 at 6:18am Jun 4, 2010 at 6:18am UTC
No.
But your question is a bit like asking "What colour is a piece of string?".
Well it depends on which tin of paint you dunk it in...