Important alert: (current site time 7/15/2013 5:40:41 PM EDT)
 

winzip icon

[ Integer Test ]

Email
Submitted on: 9/13/2002 12:09:07 AM
By: Gonzales Cenelia  
Level: Intermediate
User Rating: By 4 Users
Compatibility: C, C++ (general), Microsoft Visual C++, Borland C++, UNIX C++
Views: 18101
author picture
(About the author)
 
     Sometimes we need a way to test the user input to know if it is an integer, i have seen many algorythm for doing this,but a lot of them are incomplete since they only check to see if the input contain the numeric values from 0 to 9 if so it is said that the input is a number.Here you will fine a more precise way to test the user input for knowing if it is an integer.
 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 49 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments
12/11/2005 5:29:23 AMAlexMark

Very very good code!

What i was searching for! THANKS! :D
(If this comment was disrespectful, please report it.)

 
7/17/2006 9:49:23 PMjmae

wow thanks... but your code has error on it...anyways its ok thats was i searching for....ahehe!
(If this comment was disrespectful, please report it.)

 
7/18/2006 9:56:12 AMGonzales Cenelia

i have been checking this code many times before and i have never seen any error in it, however if you have found one, would you please tell me which one it is.
(If this comment was disrespectful, please report it.)

 
8/29/2006 12:55:47 AMTorvaun

I feel I have a function better suited to this task. It uses repetition, so it may be fairly slow comparatively, but it can more easily be dropped into any other program, and doesn't require anything more than iostream.

#include

main()
{
double number;
double temp;

std::cout<<"Please enter a number: ";
std::cin>>number;
temp=number;
if (number>=0)
{
while(temp>0)
{
temp--;
}
}
else
{
while(temp<0)
{
temp++;
}
}
if (temp == 0)
std::cout< else
std::cout< system("pause");
return 0;
}

(If this comment was disrespectful, please report it.)

 
11/6/2006 5:36:09 AMking

very good code

(If this comment was disrespectful, please report it.)

 
3/20/2007 12:54:44 AMsanthosh

only some persons only having a tendency to share all things.... thats u
(If this comment was disrespectful, please report it.)

 
3/26/2010 3:07:23 PMSohit

I will say you are genius man. Thanks keep it up good work
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.