Hey, I was wondering if there is a way to search a double for a character, like a '.'. I know you can do this with strings but is it possible to search a double?
Printable View
Hey, I was wondering if there is a way to search a double for a character, like a '.'. I know you can do this with strings but is it possible to search a double?
Well there is no standard library function that searches a numeric type for a given value. But you could easily convert the double to a string and then search for the '.' character.
I tryed to convert the double to a string already, but I get the error : can't convert 'double' to 'char'. Perhapes I am doing this wrong, I just started C++ about 1 month ago so there is a large possiblity that I did it wrong. I made 'char search[50]' then I tryed to use a loop to assign each digit to the array. If this is wrong could you please post a piece of code on how to do this.