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...
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...