0

and please note that i have made comments on the lines which compiler gives an error.

actually it compiles really well.

i think it is something wrong in the values which are assigned to floating point variables.

my email is <snipped email>

Not Yet Answered # Please Help Me

John A 1,896 Discussion Starter nadith_cs 1 ~s.o.s~ 2,560 iamthwee 1,547 Write a C program that should create a 10 element array of random integers (0 to 9). The program should total all of the numbers in the odd positions of the array and compare them with the total of the numbers in the even positions of the array and indicate ...

0

and please note that i have made comments on the lines which compiler gives an error.

actually it compiles really well.

i think it is something wrong in the values which are assigned to floating point variables.

my email is <snipped email>

0

> and please note that i have made comments on the lines which compiler gives an error.

> actually it compiles really well.

If you say that it compiles well, how come it has so many "errors"?

A good idea would be to post the code here instead of including it as an attachment; it's kind of a hassle to download the file and open it with our editor, you know?

As for your problem - sorry, I'm not that good at math. I kind of understand it; maybe someone with better math skills can explain this better...

As you noted in the bottom of your program, the variables are not completely accurate, and will sometimes contain a number that should be 0, but is instead something very close to 0. This can screw up your program, and is a common problem with other math problems such as matrix math. The best solution is to round down the number to 0 if it's smaller than a certain value (say 0.01; you might have to fine-tune it a little bit better).

0

how come it doesn't compile....it compiles really well in VISUAL C++ 6.0 without a single error.ok as u told me how do i round up the value and assign it to a variable.

eg:

i have 0.33345

and 0.003333

without using a if cond will i be able to assign the value 0 to the variable?

0

It depends on what kind of requirement is behind the rounding but you can do something like :

```
x = floor (0.23) ; // 0
x = floor (0.90) ; // 0
```

0

>which will help you to find the roots of any given function

Will it? The best way to find the roots of any given function, assuming the function has only one variable is to use numerical methods.

Some functions can also have complex solutions...

This article has been dead for over six months. Start a new discussion instead.

Recommended Articles

the function that I created to find the ...

Hi. so this is actually a continuation from another question of mineHere but i was advised to start a new thread as the original question was already answered.

This is the result of previous question answered :

code for the listbox - datagridview interaction

At the top of the code ...