This does not seem to work with the data validation code.
[PHP]char a,b;
char name[20];
int arg;
printf("Enter your name ");/*get users name*/
gets(name);
printf("Enter a the first number \n"); /*get first number*/
arg = scanf("%d", & arg);
if ( !(isdigit(arg)) ) /* if a is not a digit */
...
User Profile
Collapse
-
Okay if i enter '1' for 'a' it turns it into '49'. '2' becomes '50'. '3' becomes 51. I'm seeing a pattern here. Which if I'm not mistaken is ascii for all three numbers. Why is [PHP] ((b = getchar()));[/PHP] storing these numbers as ascii? Can this statement store this as the actual number entered?Leave a comment:
-
Ok, I actually go the data validation to work! But now after the first number is inputted prints and skips the 'enter the second number and prints 50 is smaller that 51.
I think my problem now lies within this code
[PHP] printf("Enter the second number \n"); /*get second number*/
((b = getchar()));[/PHP]
It does not seem to be storing the value entered as the actual number entered. ...Leave a comment:
-
When the program is run now I'm able to enter my name then the program bypasses the first question and ends. Not sure why.
[code=c]#include <stdio.h>
#include <ctype.h>
#include <string.h>
#define ENTER 13
void main(void)
{
char a,b;
char name[20];
printf("Enter...Leave a comment:
-
I've made some changes but it's still not working. I would like to post my code but I'm unsure how to correctly post it. Can you assist?Leave a comment:
-
I checked out the other link you sent, but it seems more for character validation. Below is my code. I thought there would be a simple way to validate whether or not data entered was a number? If not I can try something else if you have any suggestions.
BTW thanks so much for your help.
[code=cpp]
#include <stdio.h>
#include <ctype.h>
...Last edited by sicarie; Nov 13 '07, 03:26 PM. Reason: Code tags are [code=cpp] and after you put your code here, [/code]. Reading is an art form.Leave a comment:
-
No, we outsource our IT to a firm that's not too IT savy. I asked our network admin about a policy that may be blocking the firewall and she said there was not one. Yes, we're currently running Symantic anti virus.
We took all of our laptops off of the domain and now the laptop firewalls stay up. I read some articles stating that other people have had similar windows firewall issues with windows sp2 (they sounded remotley related)....Leave a comment:
-
PC joined to domain unable to restore windows firewall on pc
The problem is this, all of our laptops are running windows xp with the sp2 update. When the laptops were originally setup they were joined to our domain controller. Once joined, it seems, the windows firewall was automatically disabled, since then we have been unable to reactivate it.
Is it possible to restore windows firewall when a PC is joined to a domain(without reformatting)? -
I actually looked at the link that you sent me prior to submitting my post. I seem unable to use either statements in if/else format.
if ( !isdigit ( x ) )
printf("That is not a number \n");
Else
(run the rest of the program)
Below are the libraries I've included.
#include <stdio.h>
#include <ctype.h>
#include...Leave a comment:
-
number validation
Hi all. I'm writing a program that asks a user to enter two numbers and then outputs which number is larger than the other. The program itself was easy enough however, I also have to validate whether or not it was a number that was entered. Is there a simple way to verify that the numbers entered were actually numbers?
I attempted using this in a if statment with no luck.
if ( !isdigit ( x ) ) /* if x is not a digit...
No activity results to display
Show More
Leave a comment: