lines containing something like this /* ... */<<endl<<cout<</* ... */
are wrong, modify them as this: cout<<"Can't accept negative numbers or 0"<<endl<<"a=";
(so remove that cout<<)
The way you are using the if/else statement is correct but I think in this case a loop would be better
I guess you want to promt the user for a value, and if that value is outside a certain range (below or equal to zero) it should aks the user again. Right?
In that case, you should use a (do-)while-loop:
1 2 3 4 5 6 7 8 9
float a;
do
{
cout<<"Enter a number:"<<endl;
cin>>a;
if (a<=0)
cout<<"Can't accept negative numbers or 0"<<endl;
}
while (a<=0)
Since you would have to do this four times, you may want to create a function.