So I have been trying to write this function and implement it without luck. The function has to be written as void divisor (float x )
and it will ask a user for a int
number and run until the user inputs a value of 0 . I get a few errors one which concerns me the most is invalid operands of types ‘float’ and ‘int ’ to binary ‘operator
I have tried writing it so:
#include <iostream>
using namespace std ;
void divisor (float x )
{
int result ;
int a ;
result = x % a << endl ;
a++
return 0 ;
}
};
int main ()
{ int n ;
float arg;
cin >> arg ;
cin >> n ;
cin >> arg;
if ( n =! 0 ){
divisor ( arg) ;
}else{
cin >> n ;
} return 0 ;
} ;