A
A
Alexey FRZ2016-05-15 11:55:00
Objective-C
Alexey FRZ, 2016-05-15 11:55:00

Error in simple code, where?

#import <Foundation/Foundation.h>
double proccessOne();

int main()
{
    double metrQube;
    int gektar=2;
    metrQube=proccessOne(gektar);
    NSLog (@"Метров вышло = %.6f",metrQube);
}

double proccessOne(gektar)
{
    double formulaResult;
    formulaResult=gektar/10000;
    return formulaResult;
}

As a result, it displays zeros, but it should be 0.0002

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Zagaevsky, 2016-05-15
@leshqow

I don't know for sure, but this place
double proccessOne(gektar) is
strange. What is the type of gektar? It turns out, int? Divide 2 by 10000 to get 0 - integer division. Divide by 10000.0, for example. Or explicitly specify the type of the argument as double.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question