it seems fine to me...
it's probably something stupid.
syntactic maybe.
but i can't find it...
the program's supposed to accept a float and round it up or down depending on the float.
it's also supposed to determin whether the float is a true decimal fraction or just something like 4.0
here's the code
Code:
#include <stdio.h>
int output, run=1, frac_mod, reduce( float input);
float input, decimal;
main()
{
while(run=1)
{
printf("input a decimal fraction:\n");
scanf("%f",input);
frac_mod=reduce ( float input);
switch(frac_mod) //this is where the actual rounding is done by assigning a float into an int
{
case 2:
{
output=input+1;
printf("\n%f is rounded up to %d\n",input, output);
break;
}
case 1:
{
output=input;
printf("\n%f is rounded down to %d\n",input, output);
break;
}
default:
{
printf("\n%d is not a decimal fraction...\n\njackass\n",input);
break;
}
}
}
}
int reduce( float input) // determines which way to round, and whether input is a true fraction
{
decimal=input;
while(decimal>1)
{
if(decimal>100)
decimal=decimal-100;
else
{
if(decimal>10)
decimal=decimal-10;
else
decimal=decimal-1;
}
}
if(decimal>=0.5)
return 2;
else
{
if(decimal!=0)
return 1;
else
return 0;
}
}
the compiler says there's a "parse error before float" in line 13 of the code.
where the function reduce is first called.
do you see a problem ?
also, if you see any other problem in the program please let me know...
as i understand it a code can compile perfectly and still not a working exe make...
so any input is appreciated.