I'm trying to figure out how to use this function. I found it on the web and apparently it checks if you have a space in your string. So it's not working out for me. I've figured out that I'm not even getting into the if statement that I need to.
for (i=0;i < marks.length();i++)
{
if (isdigit(marks[i]))
{
floatMARK = 1;
}
else
{
charMARK = 1;
}
}
if (floatMARK == 1)
{
printf("were in.");
for (i=0;i < marks.length();i++)
{
if (isspace(marks[i]))
{
multiMARK = 1;
printf("WE HAVE A SPACE!!");
}
}
}
Anyone know what I'm doing wrong? If you need me to clarify anything, let me know.
bool
variables, and e.g. usingprintf
instead of C++ iostreams (in a beginner's program), seems to indicate that you have the burden of having first learned C. And if so, then you need to focus on unlearning C, and learning C++, which is a different language. Oh, by the way, could it be that you tested the code with input that didn't have digits? Then space would not be detected. Cheers & hth.,