What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » Squadratic formula in c++

Squadratic formula in c++
Author: Message:
somelauw
Junior Member
**

Avatar

Posts: 93
34 / Male / –
Joined: Jan 2006
O.P. Squadratic formula in c++
I am a beginner c++ programmer and this is my first program.
I enter:
quote:
a=5
b=10
c=5
but it shows
discriminant=-6,9e-018
I thought 10*10-4*5*5=0?

Here my code:
code:
#include <math.h>
#include <stdio.h>

int wortelformule()
{
   float a,b,c,d,x1,x2;
   printf("ax˛+bx+c=0 \n");
   printf("The value of a is ");
   scanf("%g",&a);
   printf("The value of b is ");
   scanf("%g",&b);
   printf("The value of c is ");
   scanf("%g",&c);
   d=pow(b,2)-4*a*c;
   printf("\n \nThe discriminant is %g \n",d);
   x1=(-b+pow(d,0.5))/(2*a);
   x2=(-b-pow(d,0.5))/(2*a);
   printf("The first answer is %g \n",x1);
   printf("The second answer is %g \n \n",x2);
   wortelformule();
}

main()
{
      wortelformule();
}

Please add one 6 to my postcount and I'm tha Beast!
This signature was written when my postcount was 66
08-18-2006 04:04 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Squadratic formula in c++ - by somelauw on 08-18-2006 at 04:04 PM
RE: Squadratic formula in c++ - by Adeptus on 08-19-2006 at 02:17 AM
RE: Squadratic formula in c++ - by somelauw on 08-19-2006 at 10:59 AM
RE: Squadratic formula in c++ - by Adeptus on 08-19-2006 at 03:03 PM
RE: Squadratic formula in c++ - by somelauw on 08-20-2006 at 09:23 AM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On