I have this code, which will accept a value and print it out.
This is a simple beginners class, yes....im a noob.
My problem isnt with the class, in fact the code works fine *** (with cin/cout).
I initially had made it without using cin, cout statements but i just couldn't find a way
to accept user input (character string - resistance value from 1 - 10 meg) ......to be stored as a long int.
From what i found in the library functions i got atoul(), and atol(). But these functions are hairy, and dont seem
to coonvert correctly for numbers larger than 32000 ish.
After much thinking, i gave in and used cin to a long variable...piece of cake
What i'm really wondering is, is there not an easy way to do this without using cin cout???
I dont have anything against their use, i just believe that there must be a way to do this, i'm obvoiusly
missing something important that stops me from doing this the first way i had planned.
***Technically it doesn't
(also, does anybody know why the program gets stuck in a loop with iostream.h at "return *this" line, and will constantly
print " ____is not a valid resistance please enter a value form 1 - 10 mag ohms :" over and over again)??
This is a simple beginners class, yes....im a noob.
My problem isnt with the class, in fact the code works fine *** (with cin/cout).
I initially had made it without using cin, cout statements but i just couldn't find a way
to accept user input (character string - resistance value from 1 - 10 meg) ......to be stored as a long int.
From what i found in the library functions i got atoul(), and atol(). But these functions are hairy, and dont seem
to coonvert correctly for numbers larger than 32000 ish.
After much thinking, i gave in and used cin to a long variable...piece of cake
What i'm really wondering is, is there not an easy way to do this without using cin cout???
I dont have anything against their use, i just believe that there must be a way to do this, i'm obvoiusly
missing something important that stops me from doing this the first way i had planned.
***Technically it doesn't
(also, does anybody know why the program gets stuck in a loop with iostream.h at "return *this" line, and will constantly
print " ____is not a valid resistance please enter a value form 1 - 10 mag ohms :" over and over again)??