Re: Help. Where is my error?



Red Dragon wrote:
> I am self study C student. I got stuck in the program below on
> quadratic equation and will be most grateful if someone could help
> me to unravel the mystery.
> Why does the computer refuse to execute my scanf ("%c",&q);

You posted this program a couple of weeks ago and got lots
of advice. But you seem to have ignored most of this advice.
Here it is again:

1) x1, x2, R, I, S should be "double", not "float"
2) You MUST check the return value of scanf() and take appropriate
action if it is wrong
3) Don't do any casting (eg. in the line "x1 = (float)FOO")
4) The "return 0" goes AFTER the "else" block, not inside it.

Hint: If you printf the result of your scanf("%c") using
%d, you might understand what is going on.

.



Relevant Pages

  • Re: Help. Where is my error?
    ... >I am self study C student. ... I got stuck in the program below on ... >quadratic equation and will be most grateful if someone could help me to ...
    (comp.lang.c)
  • Drop Down List / Count Function
    ... I'd be very grateful for some advice please. ... the financial cost which is column a multipled by ... effectively an alias to a value in another worksheet. ...
    (microsoft.public.excel.worksheet.functions)
  • Re: Remote Desktop Print (duplicate thread)
    ... My advice (which would most likely ... >> much like a car that is stuck in a snow drift. ... Why would I install a printer that I don't have ...
    (microsoft.public.windowsxp.general)
  • ADvice to Students, buy a Mac...
    ... because Windows software has been stuck in a rut according to Business ... " Advice to Students: Pack a Mac ... This year I have some advice for the college-bound: ...
    (comp.sys.mac.advocacy)
  • Re: Certification in C
    ... I went to the site following your advice, and I found it's (on the face of ... it) the one that offers the most interesting commitment to good testing. ... If you can spare a minute to tell me, I will be grateful. ... > patrick courant wrote: ...
    (comp.lang.c)