New to programming in general, creating a program in C with VisualStudio that would take a floating point from the user and return if it is negative or not, then get it as an integer, and finally return the first digit of the integer. Code looks something like this:
double extractDigit1(x){
double userFloatValue = x;
(userFloatValue >= 0) ? printf(" %f is a positive value.", userFloatValue) :
printf(" %f is a negative value.", userFloatValue);
}
int main(){
double userValue;
scanf_s("%lf", &userValue);
extractDigit1(userValue);
}
Entering 1234.345 gets me:
"1202590843.000000 is a positive value."
instead of:
"1234.345 is a positive value."