thanks that works. since its so short i wont bother to make it into a function. i tried to functionify it once before with my own code and it worked for valid numbers but when i entered an invalid number it stuck in an infinite loop. my piece of code was much longer though. thats why i tried using the bool function instead. i will stick with what you gave me.
moving along, could you explain in simpleton language what the last zero before the ) represents in the last line of code?
Code:
while (test.find_first_not_of("0123456789", 0) != std::string::npos);
also i was wondering how to call a function from another funtion? like in the following simple attempt.
Code:
#include <iostream>
using namespace std;
int addition (int a, int b)
{
int r;
r=multiply(a,b) + a;
return (r);
}
int multiply (int c, int d)
{
int y = c+d;
return (y);
}
int main ()
{
int z;
z = addition (5,3);
cout << "The result is " << z;
return 0;
}
i know it dont make sence mathematically, lol but i was trying something simple to help me undertsand it easier. now that gives me an error multiply identifier not found. what i am attempting to do is use the multiply function in the addition function.