sorry to keep asking but this has me baffeled.....
I changed a few things to simplify it and to debug.
When I put this:
maxnum = atoi( max );
if( maxnum > 20 )
return BOOL_TRUE;
else
Type: Posts; User: RyeDunn
sorry to keep asking but this has me baffeled.....
I changed a few things to simplify it and to debug.
When I put this:
maxnum = atoi( max );
if( maxnum > 20 )
return BOOL_TRUE;
else
somethign like this?
static int validate_whole ( char *max )
{
int maxnum;
while ( *max != '\0' )
if ( !isdigit ( *max++))
within that same function
static int validate_whole ( char *max )
{
while ( *max != '\0' )
if ( !isdigit ( *max++))
return BOOL_FALSE;
return BOOL_TRUE;
}
If I wanted to narrow the...
This is just a piece of the code but I believe the problem the is in the function where '\n' is read along with the input, therefore everthing is FLASE. (please tell me if Im wrong.) So I tried to...
Sorry if I was too vague.
Thanks for your help!
ok did get salems code to work, but is there anyway to get the same thing accomplished within the function?
here is the full function:
static int valid( char array[], int maxnum )
{
int...
If you look at the progs output, it appears that the following number entered always writes over the previous number and splits the numbers into individual characters and puts each into its own cell,...
I knew if I put that it would have been something that was pointed out....
I did try that and I do have that now but Im still having problems... Im at home now (and drunk if you dont mind, hah) so...
pardon my ignorance, but isnt that what I was doing with sscanf( a, "%c", &a[e] ); ?
Im having some difficulties inputing elements into an array using sscanf. (The book Im using only has one like about sscanf). Anyway, all Im trying to do is input numbers into an array using...
WHOA! :eek: very cool. :cool:
I was using a double at the end because my function (see below) worked better if I used it.
static int valid( char array[], int count )
{
int i = 0,...
Okay I know this snippit here has a ton of problems but there is one inparticular that is troubling me.
Under the GATHER DATA section, When a number is entered it is checked via a validate...
well Im home now and I was using salems code at work, but I swear it wasnt working properly.. but now that Im trying it from home.... I see it does work. go figure!
Well I guess that means...
ok very nice, Im much closer.... but if a the input was something like : 54k6 it would accept 54 and not return an error?
What did I miss? I thought this would go through each character and if...
lately I have been asking questions a bit over my head so Im trying to break things down a little so I can understand it better.
What Im trying to do is look at all integers and if any of them are...
yeah I think you are right, Im going to start rewriting the validate function instead of trying to work around it.
Isnt that what: sscanf(buffer, "%lf", &a); does?
And after adding the mentioned lines Im getting the error:
error C2371: 'bool' : redefinition; different basic types
Is there something else...
Ok here is what I have done and what Im trying to do.
I would like this to simply verify an integer is valid. Letters, spaces, multiple (- and .)s etc should all return false and the program will...
I posted something like this yesterday but I used a string as the input arguement type because I didnt know what else to use that actually worked and it took the emphasis of what I was really trying...
I could use cin but I would like to learn other ways of handling this. I have looked up the getline function but Im having problems implementing it for this program.
Im hoping you people could...
I might be beating a dead horse on this but:
>fflush ( stdin ) is undefined, don't use it.
Could you recommend something else that would be better?
// GATHER DATA
for (e = 0; e < maxnum;...
no offense taken... I know its all in fun and some of the questions I do ask are in the book/FAQs but sometime I have difficulty understanding or implementing it in my specific program.
Speaking...
Hammer,
Im honored to be the one you decided to slam for your 1000th post. Congrats. :cool:
Rye
tough crowd.
I understand now.... you guys rock!
Just wait until you see what my next question is going to be tomorrow.. . muhahah
:D