Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   input problems (http://www.go4expert.com/forums/input-problems-t640/)

musicmancanora4 16Mar2006 14:54

input problems
1 Attachment(s)
Hi guys im having a big issue with my program iv attached the pogram because iv recieved all sorts of stuff of what the problem could be.

if you take a look at the source code of cal.c im calling the getUserInput function then calling another function called validate month to validate the input from the getUserInput function..

However its not validating any of the input correctly at all and im 100 % sure there's nothing wrong with my validation coding..

So when i type a month between 0 - 12 i still get an error saying that its an incorrect month when it shouldnt be.. 0 is valid because thats suppose to display all months..

Its sorta difficult to explain if someone could run the program and test the conditionals in the validation function you will see what i mean..

im going nuts someone plz solve it thnxs

shabbir 16Mar2006 21:29

Re: input problems
Just find the following lines in cal.c in the function unsigned getMonth()
Code: C

month = getUserInput(prompt);
month = validateMonth(prompt,month );

and replace it with the following lines
Code: C

month = getUserInput(prompt);
valMonth = atoi(month);
month = validateMonth(valMonth,prompt);

This should solve your problem of prompt.


coderzone 17Mar2006 06:55

Re: input problems
That what I was explaining to him in do while prob on validation thread

All times are GMT +5.5. The time now is 22:26.