in the following program I only want the concept from U that what should i do so plz don't correct the code by ur-self I want to do it my self.in the following code when i am saying C++ that if a user enter number <= 0 again take the in-put from the users by returning back to main it gives logcal errors. for example i tried it like
return (i);
I got error. after that i said to it
cout<<"Enter the number again : " <<endl;
cin>>i;
again i got the error " I am not made to calculate below 0" even though number i entered was +ve.I don't want to use "break" word any were in my code.
//Taking input from user & making cube via function.
#include <iostream>
usingnamespace std;
int multiplyfunc (int i)
{
int wapis;
if (i <= 0)
//added cout with purpose to get value from user again to process via cin. but logical error
cout<<" I am not made to calcule below 0 : \n";
cin>>i;
wapis = i*i*i;
return (wapis);
}
int main()
{
int i ;
cout<<"Enter the number please = "<<endl;
cin>>i;
multiplyfunc(i);
cout<<"Multiplication done in function & answer back in main "<<multiplyfunc(i)<<endl;
system ("Pause");
return 0;
}