473,761 Members | 1,808 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 unravel the mystery.
Why does the computer refuse to execute my scanf ("%c",&q);
On input 3 4 1 (for a,b and c) I had real roots OK
On input 1 8 16 I had same real roots OK.

However on 4 2 5, (for imaginary roots ) the computer cannot see the scanf ("%c",&q); statement. It just jumps over it.
How can I make the computer not to ignore this statement? I am on Visual C++ platform.
Thanks
Khoon.

/* Roots of a Quadratic Equation.
12.10.05 */

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main (void)

{
int a; int b; int c; float x1; float x2; int E; int E1; float R; float I;float S;
char p; char q; char y;

printf ("Please key in the value of constant a,b and c for finding the roots of quadratic");
printf ("equation ax%c+bx+c=0 :",253);
scanf ("%d%d%d", &a,&b,&c);

E =(b*b)-(4*a*c);

if ( E > 0)
{
x1 = (float)(-b+sqrt(E))/(2*a);
x2 = (float)(-b-sqrt(E))/(2*a);

printf ("\nYour quadratic equation has two distinct real roots: x1=%1.6f ,x2=%1.6f",x1,x 2);
}

else if (E == 0)
{

x1 = (float)(-b+sqrt(E))/(2*a);

printf ("\nYour quadratic equation has two same: x1=x2=%1.6f\n", x1);
}

else
{

p = 'y';

printf ("Your quadratic equation has two distinct imaginary roots. Do you want to know\n");
printf ("the values of the imaginary roots (Y/N)?");

scanf ("%c",&q);

printf ("\nq = %c\n",q);/* Test statement*/

if (p==q)
printf ("OK I will show your the imaginary roots tomorrow.\n");

else
printf ("Good bye\n");

return 0;

}
}

Nov 15 '05
38 2548

"Old Wolf" <ol*****@inspir e.net.nz> wrote in message news:11******** *************@g 43g2000cwa.goog legroups.com...
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"
Thank you for your help and I very much appreciate it. I am doing the exercise in my book and since precision is not an issue here, I have put it on lower priority. But as you rightly point out. I will adopt it as I will be dealing with big figures.
2) You MUST check the return value of scanf() and take appropriate
action if it is wrong
I was doing this. That is why I call it "test statement".
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.


Thanks
Khoon.

Nov 15 '05 #11
Red Dragon wrote:


"Old Wolf" <ol*****@inspir e.net.nz> wrote in message
news:11******** *************@g 43g2000cwa.goog legroups.com...

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"


Thank you for your help and I very much appreciate it. I am doing the
exercise in my book and since precision is not an issue here, I have
put it on lower priority. But as you rightly point out. I will
adopt it as I will be dealing with big figures.


What are you waiting for?
Unless you have an array of them,
small arithmetic types like float, short, and char,
which often get quietly converted to larger types,
are very probably a poor choice.

2) You MUST check the return value of scanf() and take appropriate
action if it is wrong


I was doing this. That is why I call it "test statement".


int rc;

rc = scanf("%c", &q);
printf("scanf returned a value of %d\n", rc); /* Test statement*/

--
pete
Nov 15 '05 #12
I have got all the results by using 2 scanf(). One is a dummy. I am also using double instead of float.
Below are the results. I am copying and paste from Notepad, so I hope I dont have HTML problem.
Regards,
Khoon
/* Roots of a Quadratic Equation.
12.10.05 */

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main (void)

{
int a; int b; int c; double x1; double x2; double E; int E1; double R; double I;double S;
char q; char Y;

printf ("Please key in the value of constant a,b and c for finding the roots of quadratic");
printf ("equation ax%c+bx+c=0 :",253);
scanf ("%d%d%d", &a,&b,&c);

E =(b*b)-(4*a*c);

if ( E > 0)
{
x1 = (float)(-b+sqrt(E))/(2*a);
x2 = (float)(-b-sqrt(E))/(2*a);

printf ("\nYour quadratic equation has two distinct real roots: x1=%1.6f ,x2=%1.6f",x1,x 2);
}

else if (E == 0)
{

x1 = (float)(-b+sqrt(E))/(2*a);

printf ("\nYour quadratic equation has two same: x1=x2=%1.6f\n", x1);
}

else

{

printf ("Your quadratic equation has two distinct imaginary roots. Do you want to know");
printf ("\nthe values of the imaginary roots (Y/N)?");

scanf ("%c",&q); /* Dummy. The computer jumps this scanf() */

scanf ("%c",&q);

printf ("q = %c\n",q); /* Test statement*/

if ('Y'==q)
{
R = (float)-b/(2*a);
S=abs(E);
S=sqrt(S);
I = S/(2*a);
printf ("\nThe imaginary roots are:\n");
printf (" x1=%1.6f + %1.6fi , x2=%1.6f - %1.6fi\n",R,I,R ,I);
}
else
printf ("Thank you for using this computer\n");
}
return 0;
}

/* RESULT
Please key in the value of constant a,b and c for finding the roots of quadratic
equation ax²+bx+c=0 :3 4 1

Your quadratic equation has two distinct real roots: x1=-0.333333 ,x2=-1.000000
Press any key to continue */

/*Please key in the value of constant a,b and c for finding the roots of quadratic
equation ax²+bx+c=0 :1 8 16

Your quadratic equation has two same: x1=x2=-4.000000
Press any key to continue */

/*Please key in the value of constant a,b and c for finding the roots of quadrati
equation ax²+bx+c=0 :4 2 5
Your quadratic equation has two distinct imaginary roots. Do you want to know
the values of the imaginary roots (Y/N)?Y
q = Y

The imaginary roots are:
x1=-0.250000 + 1.089725i , x2=-0.250000 - 1.089725i
Press any key to continue*/

/*Please key in the value of constant a,b and c for finding the roots of quadratic
equation ax²+bx+c=0 :4 2 5
Your quadratic equation has two distinct imaginary roots. Do you want to know
the values of the imaginary roots (Y/N)?N
q = N
Thank you for using this computer
Press any key to continue*/


Nov 15 '05 #13
Red Dragon <ts*****@stream yx.com> wrote:
1. The dont understand the HTML thing. I did not use HTML. What I did was
to copy from my Visual C++ platform and paste on the Outlook Express
screen. With Mr. Skarmander's instruction, I have set the radio button to
"Plain Text" on the Send Tab and thought the problem is solved. I have
actually sent a copy of the outgoing mail to myself and I dont see any HTML
thing on my screen on the returned copy. So I dont know what else to do.


Well, whatever you've done worked for this post, at least - we'll let
you know if the problem occurs again.

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cybers pace.org | don't, I need to know. Flames welcome.
Nov 15 '05 #14
> What are you waiting for?
Unless you have an array of them,
small arithmetic types like float, short, and char,
which often get quietly converted to larger types,
are very probably a poor choice.

> 2) You MUST check the return value of scanf() and take appropriate
> action if it is wrong


I was doing this. That is why I call it "test statement".


int rc;

rc = scanf("%c", &q);
printf("scanf returned a value of %d\n", rc); /* Test statement*/

--
pete


Hi Pete,
I have already been using double.
As for the test, I find that for all inputs of q, "rc" registers 1.
So what is it suppose to test? What does it suppose to show?
I cannot see how to make use of it because everything I do, "scanf returned
a value of 1".
Thanks
Khoon.

Nov 15 '05 #15
> Well, whatever you've done worked for this post, at least - we'll let
you know if the problem occurs again.


This post of course works because I dont have any C- program loaded on it.
I have yet to see when I paste a C-program on it, what will be its
outcome.

Now I paste from Notepad and not directly from Visual C++ platform.
Please let me know if the problem occurs again.
Thanks
Khoon.

Nov 15 '05 #16
"Red Dragon" <ts*****@stream yx.com> writes:

You have been repeatedly asked not to post using HTML.
Please stop it. This is usenet, not some mailing list or forum.
[snip]
Mr. Michael,
I wish to apologize for causing you problem. I did not know I was causing a
problem.
1. The dont understand the HTML thing. I did not use HTML. What I did was
to copy from my Visual C++ platform and paste on the Outlook Express
screen. With Mr. Skarmander's instruction, I have set the radio button to
"Plain Text" on the Send Tab and thought the problem is solved. I have
actually sent a copy of the outgoing mail to myself and I dont see any HTML
thing on my screen on the returned copy. So I dont know what else to do.
I suggest trying a mail tool other than Microsoft Outlook Express.
Microsoft mail software is well known for behaving in ways that
can cause problems like this.

Probably what you're using to read news hides the HTML-ness
of what you're posting. FYI, here is what gets transmitted
(each line has '>->-> ' at the beginning). I expect you can
see why other people don't like reading postings like this.

->-> From: "Red Dragon" <ts*****@stream yx.com>
->-> Subject: Re: Help. Where is my error?
->-> Newsgroups: comp.lang.c
->-> Date: Tue, 18 Oct 2005 20:43:20 +0800
->-> Organization: TMnet Malaysia References: <43********@new s.tm.net.my> <11************ *********@g43g2 000cwa.googlegr oups.com> <43**********@n ews.tm.net.my>
Lines: 281
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="----=_NextPart_000_ 000E_01C5D424.9 4159240"
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
NNTP-Posting-Host: 218.111.62.120
X-Original-NNTP-Posting-Host: 218.111.62.120
Message-ID: <43********@new s.tm.net.my>
X-Trace: news.tm.net.my 1129639409 218.111.62.120 (18 Oct 2005 20:43:29 +0800)
Path: nntp-server.caltech. edu!hammer.uore gon.edu!news.gl orb.com!news-feed01.roc.ny.f rontiernet.net! nntp.frontierne t.net!uunet!spo ol.news.uu.net! ash.uu.net!news 1.tm.net.my!not-for-mail->->
->-> This is a multi-part message in MIME format.
->->
->-> ------=_NextPart_000_ 000E_01C5D424.9 4159240
->-> Content-Type: text/plain;
->-> charset="iso-8859-1"
->-> Content-Transfer-Encoding: quoted-printable
->->
->-> I have got all the results by using 2 scanf(). One is a dummy. I am =
->-> also using double instead of float.=20
->-> Below are the results. I am copying and paste from Notepad, so I hope =
->-> I dont have HTML problem.=20
->-> Regards,
->-> Khoon
->->
->->
->-> /* Roots of a Quadratic Equation.
->-> 12.10.05 */
->->
->-> #include <stdio.h>
->-> #include <stdlib.h>
->-> #include <math.h>
->->
->-> int main (void)
->->
->-> {
->-> int a; int b; int c; double x1; double x2; double E; int E1; double R; =
->-> double I;double S;
->-> char q; char Y;
->->
->-> printf ("Please key in the value of constant a,b and c for finding the =
->-> roots of quadratic");
->-> printf ("equation ax%c+bx+c=3D0 :",253);
->-> scanf ("%d%d%d", &a,&b,&c);
->-> =20
->-> E =3D(b*b)-(4*a*c);
->-> =20
->-> if ( E > 0)=20
->-> { =20
->-> x1 =3D (float)(-b+sqrt(E))/(2*a);
->-> x2 =3D (float)(-b-sqrt(E))/(2*a);
->->
->-> printf ("\nYour quadratic equation has two distinct real roots: =
->-> x1=3D%1.6f ,x2=3D%1.6f",x1 ,x2);
->-> }
->-> =20
->-> else if (E =3D=3D 0)=20
->-> {
->->
->-> x1 =3D (float)(-b+sqrt(E))/(2*a);
->-> =20
->-> printf ("\nYour quadratic equation has two same: =
->-> x1=3Dx2=3D%1.6f \n",x1);
->-> }
->-> =20
->-> else=20
->->
->-> {
->->
->-> printf ("Your quadratic equation has two distinct imaginary roots. Do =
->-> you want to know");
->-> printf ("\nthe values of the imaginary roots (Y/N)?");
->-> =20
->-> scanf ("%c",&q); /* Dummy. The computer jumps this =
->-> scanf() */
->->
->-> scanf ("%c",&q);
->->
->-> printf ("q =3D %c\n",q); /* Test statement*/
->->
->-> if ('Y'=3D=3Dq)
->-> {
->-> R =3D (float)-b/(2*a);
->-> S=3Dabs(E);
->-> S=3Dsqrt(S);
->-> I =3D S/(2*a);
->-> printf ("\nThe imaginary roots are:\n");
->-> printf (" x1=3D%1.6f + %1.6fi , x2=3D%1.6f - %1.6fi\n",R,I,R ,I);
->-> }
->-> else
->-> printf ("Thank you for using this computer\n");
->-> }
->-> return 0;
->-> }
->->
->-> /* RESULT
->-> Please key in the value of constant a,b and c for finding the roots of =
->-> quadratic
->-> equation ax=B2+bx+c=3D0 :3 4 1
->->
->-> Your quadratic equation has two distinct real roots: x1=3D-0.333333 =
->-> ,x2=3D-1.000000
->-> Press any key to continue */
->->
->-> /*Please key in the value of constant a,b and c for finding the roots of =
->-> quadratic
->-> equation ax=B2+bx+c=3D0 :1 8 16
->->
->-> Your quadratic equation has two same: x1=3Dx2=3D-4.000000
->-> Press any key to continue */
->->
->-> /*Please key in the value of constant a,b and c for finding the roots of =
->-> quadrati
->-> equation ax=B2+bx+c=3D0 :4 2 5
->-> Your quadratic equation has two distinct imaginary roots. Do you want =
->-> to know
->-> the values of the imaginary roots (Y/N)?Y
->-> q =3D Y
->->
->-> The imaginary roots are:
->-> x1=3D-0.250000 + 1.089725i , x2=3D-0.250000 - 1.089725i
->-> Press any key to continue*/
->->
->-> /*Please key in the value of constant a,b and c for finding the roots of =
->-> quadratic
->-> equation ax=B2+bx+c=3D0 :4 2 5
->-> Your quadratic equation has two distinct imaginary roots. Do you want =
->-> to know
->-> the values of the imaginary roots (Y/N)?N
->-> q =3D N
->-> Thank you for using this computer
->-> Press any key to continue*/
->-> =20
->->
->-> ------=_NextPart_000_ 000E_01C5D424.9 4159240
->-> Content-Type: text/html;
->-> charset="iso-8859-1"
->-> Content-Transfer-Encoding: quoted-printable
->->
->-> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
->-> <HTML><HEAD>
->-> <META http-equiv=3DContent-Type content=3D"text/html; =
->-> charset=3Diso-8859-1">
->-> <META content=3D"MSHT ML 6.00.2900.2769" name=3DGENERATO R>
->-> <STYLE></STYLE>
->-> </HEAD>
->-> <BODY bgColor=3D#ffff ff>
->-> <DIV><FONT face=3DArial size=3D2>I have got all the results by using 2=20
->-> scanf().&nbsp; One is a dummy. &nbsp;I am also using double instead of =
->-> float.=20
->-> </FONT></DIV>
->-> <DIV><FONT face=3DArial size=3D2>Below are the results.&nbsp; I am =
->-> copying&nbsp; and=20
->-> paste from Notepad, so I hope I dont have HTML problem. </FONT></DIV>
->-> <DIV><FONT face=3DArial size=3D2>Regard s,</FONT></DIV>
->-> <DIV><FONT face=3DArial size=3D2>Khoon</FONT></DIV>
->-> <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
->-> <DIV>&nbsp;</DIV>
->-> <DIV><FONT face=3DArial size=3D2>&nbsp; <FONT =
->-> color=3D#000080 ><STRONG>/*&nbsp;&nbsp;=2 0
->-> Roots of a Quadratic Equation.<BR>&n bsp;&nbsp;&nbsp ;&nbsp;&nbsp; =
->-> 12.10.05&nbsp;= 20
->-> */</STRONG></FONT></FONT></DIV>
->-> <DIV><FONT face=3DArial color=3D#000080 =
->-> size=3D2><STRON G></STRONG></FONT>&nbsp;</DIV>
->-> <DIV><FONT face=3DArial color=3D#000080 size=3D2><STRON G>#include=20
->-> &lt;stdio.h&gt; <BR>#include &lt;stdlib.h&gt ;<BR>#include=2 0
->-> &lt;math.h&g t;</STRONG></FONT></DIV>
->-> <DIV><FONT color=3D#000080 ><STRONG></STRONG></FONT>&nbsp;</DIV>
->-> <DIV><FONT face=3DArial color=3D#000080 size=3D2><STRON G>int main=20
->-> (void)</STRONG></FONT></DIV>
->-> <DIV><FONT color=3D#000080 ><STRONG></STRONG></FONT>&nbsp;</DIV>
->-> <DIV><FONT face=3DArial color=3D#000080 size=3D2><STRON G>{<BR>&nbsp;in t =
->-> a; int b; int=20
->-> c; double x1; double x2; double E; int E1; double R; double I;double=20
->-> S;<BR>&nbsp;&nb sp;&nbsp; char q; char Y;</STRONG></FONT></DIV>
->-> <DIV><FONT color=3D#000080 ><STRONG></STRONG></FONT>&nbsp;</DIV>
->-> <DIV><FONT face=3DArial color=3D#000080 size=3D2><STRON G>&nbsp;printf =
->-> ("Please key in=20
->-> the value of constant a,b and c for finding the roots of=20
->-> quadratic");<BR >&nbsp;&nbsp;&n bsp; printf ("equation ax%c+bx+c=3D0&n bsp; =
->->
->-> :",253);<BR>&nb sp;scanf ("%d%d%d", =
->-> &amp;a,&amp;b,& amp;c);<BR>&nbs p;&nbsp;&nbsp;= 20
->-> <BR>&nbsp;&nbsp ;&nbsp; E&nbsp; =
->-> =3D(b*b)-(4*a*c);<BR>&nb sp;<BR>&nbsp;&n bsp; if ( E=20
->-> &gt; 0) <BR>&nbsp;&nbsp ; {&nbsp;&nbsp;&n bsp;&nbsp; =
->-> <BR>&nbsp;&nbsp ;&nbsp; x1 =3D=20
->-> (float)(-b+sqrt(E))/(2*a);<BR>&nbsp ;&nbsp;&nbsp; x2 =3D=20
->-> (float)(-b-sqrt(E))/(2*a);</STRONG></FONT></DIV>
->-> <DIV><FONT color=3D#000080 ><STRONG></STRONG></FONT>&nbsp;</DIV>
->-> <DIV><FONT face=3DArial color=3D#000080 =
->-> size=3D2><STRON G>&nbsp;&nbsp;p rintf ("\nYour=20
->-> quadratic equation has two distinct real roots: x1=3D%1.6f=20
->-> ,x2=3D%1.6f",x1 ,x2);<BR>&nbsp; &nbsp; }<BR>&nbsp;&nbs p; <BR>&nbsp;&nbsp ; =
->-> else if (E=20
->-> =3D=3D 0) <BR>&nbsp;&nbsp ; {</STRONG></FONT></DIV>
->-> <DIV><FONT color=3D#000080 ><STRONG></STRONG></FONT>&nbsp;</DIV>
->-> <DIV><FONT face=3DArial color=3D#000080 =20
->-> size=3D2><STRON G>&nbsp;&nbsp;& nbsp;&nbsp;&nbs p; x1 =3D=20
->-> (float)(-b+sqrt(E))/(2*a);<BR>&nbsp ;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp ;=20
->-> <BR>&nbsp;&nbsp ; printf ("\nYour quadratic equation has two same:=20
->-> x1=3Dx2=3D%1.6f \n",x1);<BR>&nb sp;&nbsp; }<BR>&nbsp; <BR>&nbsp;&nbsp ; =
->-> else=20
->-> </STRONG></FONT></DIV>
->-> <DIV><FONT color=3D#000080 ><STRONG></STRONG></FONT>&nbsp;</DIV>
->-> <DIV><FONT face=3DArial color=3D#000080 size=3D2><STRON G>&nbsp;&nbsp;= 20
->-> {</STRONG></FONT></DIV>
->-> <DIV><FONT color=3D#000080 ><STRONG></STRONG></FONT>&nbsp;</DIV>
->-> <DIV><FONT face=3DArial color=3D#000080 size=3D2><STRON G>&nbsp; printf =
->-> ("Your=20
->-> quadratic equation has two distinct imaginary roots.&nbsp; Do you want =
->-> to=20
->-> know");<BR>&nbs p; printf ("\nthe values of the imaginary roots=20
->-> (Y/N)?");<BR>&nbsp ;<BR>&nbsp; scanf=20
->-> ("%c",&amp;q );</STRONG>&nbsp;&n bsp;&nbsp;&nbsp ;&nbsp;&nbsp;&n bsp;&nbsp;&n=
->-> bsp;&nbsp;&nbsp ;&nbsp;=20
->-> &nbsp;<FONT color=3D#008080 ><STRONG>/*&nbsp;Dummy. &nbsp;The computer =
->-> jumps this=20
->-> scanf() */</STRONG></FONT></FONT></DIV>
->-> <DIV><FONT color=3D#000080 ><STRONG></STRONG></FONT>&nbsp;</DIV>
->-> <DIV><FONT face=3DArial color=3D#000080 size=3D2><STRON G>&nbsp; scanf=20
->-> ("%c",&amp;q );</STRONG></FONT></DIV>
->-> <DIV><FONT color=3D#000080 ><STRONG></STRONG></FONT>&nbsp;</DIV>
->-> <DIV><FONT face=3DArial color=3D#000080 size=3D2><STRON G>&nbsp; printf =
->-> ("q =3D=20
->-> %c\n",q<FONT color=3D#008080 >)<FONT=20
->-> color=3D#000080 >;&nbsp;</FONT>&nbsp;&nbs p;&nbsp;&nbsp; &nbsp;/* Test=20
->-> statement*/</FONT></STRONG></FONT></DIV>
->-> <DIV><FONT color=3D#000080 ><STRONG></STRONG></FONT>&nbsp;</DIV>
->-> <DIV><FONT face=3DArial color=3D#000080 size=3D2><STRON G>&nbsp; if =
->-> ('Y'=3D=3Dq)<BR >&nbsp;=20
->-> {<BR>&nbsp;&nbs p;&nbsp;&nbsp;& nbsp; R =3D=20
->-> (float)-b/(2*a);<BR>&nbsp ;&nbsp;&nbsp;&n bsp;&nbsp; =
->-> S=3Dabs(E);<BR> &nbsp;&nbsp; =20
->-> S=3Dsqrt(S);<BR >&nbsp;&nbsp; I =3D =
->-> S/(2*a);<BR>&nbsp ;&nbsp;&nbsp;&n bsp;&nbsp; printf=20
->-> ("\nThe imaginary roots are:\n");<BR>&n bsp;&nbsp;&nbsp ;&nbsp;&nbsp; =
->-> printf ("=20
->-> x1=3D%1.6f + %1.6fi , x2=3D%1.6f - %1.6fi\n",R,I,R ,I);<BR>&nbsp; =
->-> }<BR>&nbsp;=20
->-> else<BR>&nbsp;& nbsp; printf ("Thank you for using this=20
->-> computer\n");<B R>}<BR>&nbsp; return 0;<BR>}</STRONG></FONT></DIV>
->-> <DIV><FONT color=3D#000080 ><STRONG></STRONG></FONT>&nbsp;</DIV>
->-> <DIV><FONT face=3DArial color=3D#000080 size=3D2><STRON G>/* =
->-> RESULT<BR>Pleas e key in=20
->-> the value of constant a,b and c for finding the roots of =
->-> quadratic<BR>eq uation=20
->-> ax=B2+bx+c=3D0& nbsp; :3 4 1</STRONG></FONT></DIV>
->-> <DIV><FONT color=3D#000080 ><STRONG></STRONG></FONT>&nbsp;</DIV>
->-> <DIV><FONT face=3DArial color=3D#000080 size=3D2><STRON G>Your quadratic =
->-> equation has=20
->-> two distinct real roots: x1=3D-0.333333 ,x2=3D-1.000000<BR>Pre ss any key =
->-> to continue=20
->-> */</STRONG></FONT></DIV>
->-> <DIV><FONT color=3D#000080 ><STRONG></STRONG></FONT>&nbsp;</DIV>
->-> <DIV><FONT face=3DArial color=3D#000080 size=3D2><STRON G>/*Please key in =
->-> the value of=20
->-> constant a,b and c for finding the roots of quadratic<BR>eq uation=20
->-> ax=B2+bx+c=3D0& nbsp; :1 8 16</STRONG></FONT></DIV>
->-> <DIV><FONT color=3D#000080 ><STRONG></STRONG></FONT>&nbsp;</DIV>
->-> <DIV><FONT face=3DArial color=3D#000080 size=3D2><STRON G>Your quadratic =
->-> equation has=20
->-> two same: x1=3Dx2=3D-4.000000<BR>Pre ss any key to continue =
->-> */</STRONG></FONT></DIV>
->-> <DIV><FONT color=3D#000080 ><STRONG></STRONG></FONT>&nbsp;</DIV>
->-> <DIV><FONT face=3DArial color=3D#000080 size=3D2><STRON G>/*Please key in =
->-> the value of=20
->-> constant a,b and c for finding the roots of quadrati<BR>equ ation=20
->-> ax=B2+bx+c=3D0& nbsp; :4 2 5<BR>Your quadratic equation has two distinct =
->-> imaginary=20
->-> roots.&nbsp; Do you want to know<BR>the values of the imaginary roots=20
->-> (Y/N)?Y<BR>q =3D Y</STRONG></FONT></DIV>
->-> <DIV><FONT color=3D#000080 ><STRONG></STRONG></FONT>&nbsp;</DIV>
->-> <DIV><FONT face=3DArial color=3D#000080 size=3D2><STRON G>The imaginary =
->-> roots=20
->-> are:<BR>x1=3D-0.250000 + 1.089725i , x2=3D-0.250000 - 1.089725i<BR>Pr ess =
->-> any key to=20
->-> continue*/</STRONG></FONT></DIV>
->-> <DIV><FONT color=3D#000080 ><STRONG></STRONG></FONT>&nbsp;</DIV>
->-> <DIV><FONT face=3DArial color=3D#000080 size=3D2><STRON G>/*Please key in =
->-> the value of=20
->-> constant a,b and c for finding the roots of quadratic<BR>eq uation=20
->-> ax=B2+bx+c=3D0& nbsp; :4 2 5<BR>Your quadratic equation has two distinct =
->-> imaginary=20
->-> roots.&nbsp; Do you want to know<BR>the values of the imaginary roots=20
->-> (Y/N)?N<BR>q =3D N<BR>Thank you for using this computer<BR>Pre ss any key =
->-> to=20
->-> continue*/<BR>&nbsp;&nbsp ; <BR></STRONG></FONT></DIV></BODY></HTML>
->->
->-> ------=_NextPart_000_ 000E_01C5D424.9 4159240--
->->

Nov 15 '05 #17
>>->-> any key to=20
->-> continue*/</STRONG></FONT></DIV>
->-> <DIV><FONT color=3D#000080 ><STRONG></STRONG></FONT>&nbsp;</DIV>
->-> <DIV><FONT face=3DArial color=3D#000080 size=3D2><STRON G>/*Please
key in =
->-> the value of=20
->-> constant a,b and c for finding the roots of quadratic<BR>eq uation=20
->-> ax=B2+bx+c=3D0& nbsp; :4 2 5<BR>Your quadratic equation has two
distinct =
->-> imaginary=20
->-> roots.&nbsp; Do you want to know<BR>the values of the imaginary
roots=20
->-> (Y/N)?N<BR>q =3D N<BR>Thank you for using this computer<BR>Pre ss any
key =
->-> to=20
->-> continue*/<BR>&nbsp;&nbsp ; <BR></STRONG></FONT></DIV></BODY></HTML>
->->
->-> ------=_NextPart_000_ 000E_01C5D424.9 4159240--
->->

Thank you Tim,
I absolutely have no idea of the problem until I saw your post to me. Not
even I dont like to read it, I am unable to read it.
I had purposely sent myself a returned copy of the mail and it was not like
this. The returned copy had not a single line of HTML code.
I suppose why this problem arises is because only readers with Outlook
Express get the mail in its perfect state. Others with different platform
will get it all in HTML.
Thanks for enlightening me.
Regards,
Khoon.

Nov 15 '05 #18
On Tue, 18 Oct 2005 17:57:50 +0800, in comp.lang.c , "Red Dragon"
<ts*****@stream yx.com> wrote:
I dont quite understand the phrase "newline to terminate the line".


How many keys do you press, when you supply user input value of 1? One
key or two?
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt >

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Nov 15 '05 #19

"Mark McIntyre" <ma**********@s pamcop.net> wrote in message
news:5t******** *************** *********@4ax.c om...
On Tue, 18 Oct 2005 17:57:50 +0800, in comp.lang.c , "Red Dragon"
<ts*****@stream yx.com> wrote:
I dont quite understand the phrase "newline to terminate the line".


How many keys do you press, when you supply user input value of 1? One
key or two?
--
Mark McIntyre


2 keys. One for 1 and One for Enter.
Can you kindly tell me is using 2 scanf() the best solution to the problem?
What is a better method?
Thanks
Rgds,
Khoon.


Nov 15 '05 #20

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
4347
by: wukexin | last post by:
Help me, good men. I find mang books that introduce bit "mang header files",they talk too bit,in fact it is my too fool, I don't learn it, I have do a test program, but I have no correct doing result in any way. Who can help me, I thank you very very much. list.cpp(main program) //-------------------------------------------------------------------------- - #pragma hdrstop #pragma argsused
5
2148
by: xuatla | last post by:
Hi, I encountered the following compile error of c++ and hope to get your help. test2.cpp: In member function `CTest CTest::operator+=(CTest&)': test2.cpp:79: error: no match for 'operator=' in '*this = CTest::operator+(CTest&)((+t2))' test2.cpp:49: error: candidates are: CTest CTest::operator=(CTest&) make: *** Error 1
9
3039
by: YZK | last post by:
Hello. I'm not a Web developer, just a user, and I think I may have somehow messed myself up majorly. I'm not quite sure how. Right now, javascript used by websites I go to either does not work at all, or works sporadically. I'm talking about things like Hotmail, Yahoo Address Book, buttons on various sites, etc.. I'm a computer person, but not a Web OR Javascript person. Is there any way I can "start over again?" Can I, a Windows 98...
8
5479
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- Hello, I have a very simple problem but cannot seem to figure it out. I have a very simple php script that sends a test email to myself. When I debug it in PHP designer, it works with no problems, I get the test email. If
1
4348
by: Dave | last post by:
I am having problems accessing DTS after install SP4 and was wondering if someone could offer some advice. I installed SP4 and got the following error after it competed. Unable to write to response file 'U:\WINDOWS\setup.iss' during recording. Please ensure enough space is available on target drive. I got the error 3 times (3 pop-ups).
6
1762
by: Jax | last post by:
I have Visual Studio 2002 Standard Edition. It has been working fine up to a point and now i'm at that point. Due to the limitations of the edition i am not using any of my own .dll's and instead have a range of .cs classes doing that role for me. Does that matter? I have four errors that I just dont understand, I really need some help on this or pointers to where I can find the
5
1800
by: Marc Violette | last post by:
<Reply-To: veejunk@sympatico.ca> Hello, I'm hoping someone can help me out here... I'm a beginner ASP.NET developper, and am trying to follow a series of exercises in the book entitled "Microsoft ASP.NET Step By Step" by Microsoft Press. When I try to display *any* ASP.NET page with a Sub() somewhere, I get the following error:
6
4996
by: James Radke | last post by:
Hello, I have a multithreaded windows NT service application (vb.net 2003) that I am working on (my first one), which reads a message queue and creates multiple threads to perform the processing for long running reports. When the processing is complete it uses crystal reports to load a template file, populate it, and then export it to a PDF. It works fine so far....
1
3718
by: Rahul | last post by:
Hi Everybody I have some problem in my script. please help me. This is script file. I have one *.inq file. I want run this script in XML files. But this script errors shows . If u want i am attach this script files and inq files. I cant understand this error. Please suggest me. You can talk with my yahoo id b_sahoo1@yahoo.com. Now i am online. Plz....Plz..Plz...
12
2478
by: =?Utf-8?B?ZGdvdw==?= | last post by:
I designed a "contact_us" page in visual web developer 2005 express along with EW2 after viewing tutorials on asp.net's help page. Features work like they should, but I cannot figure out how to send contact info to email or data base when the "send" button is pressed. I've watched the tutorials over & over again. I just can't get it. Link: http://www.syfloristonline.zipa.com/contact_us.aspx. Need help
0
9377
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10136
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9989
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9925
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9811
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8814
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7358
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5266
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
3509
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.