I have one more question... last one for now.
Write a program (by using a single compund if statement) to determine whether the user enters an odd positive number.
Here is what I did :
The problem is that when the user enters a float then it crashes...Code::
#include <iostream.h>
main()
{
int a;
while(1)
{
cout << "please enter a number\n";
cin >>(int)a;
if((a>0)&&(a%2))
{
cout << "You have entered an odd positive number\n";}
}
return 0;
}