Einzelnen Beitrag anzeigen
Alt 21.10.2003, 23:17   #10
Groovy
Inventar
 
Registriert seit: 24.01.2001
Beiträge: 5.107


Standard

ich hab's nun anders gelöst...
Auf Modulo hab ich ganz verzichtet und stattdessen hab ich double vom int subtrahiert.
Falls 0 = ganze Zahl, sonst keine Ganze Zahl.

#include <iostream.h>



int main()
{
double a;

cout<<"Geben sie eine Zahl ein";
cin>>a;

if (a- int(a)==0)
cout<<"Ganze Zahl ";
else
cout<<"keine ganze Zahl ";
}
Groovy ist offline   Mit Zitat antworten