Click to See Complete Forum and Search --> : Need your help due Monday


Nelly
02-25-2001, 02:54 AM
How do you check the input value from a keyboard in visual c++ to see if the
value is an integer or not??? Here is an exsample of my code:

#include "stdafx.h"
#include <iostream.h>
#include <stdio.h>

void main(void)
{
int ttime, // Total time in seconds
tmin, // Total time in minutes
tsec, // Total time in seconds
song; // Number of song


startit:
cout << "\nEnter the mintues : ";
cin >> tmin;
if (Isnumber(tmin))
cout << tmin << " is a integer.\n";
else
{
cout << tmin << " is not an integer.\n";
goto startit;
}
}


Thank you for the help...

Danny Kalev
02-25-2001, 03:33 AM
best to read the input into a string and then check it to decide whether
the input is an integer or not.

Danny