Jack's Blog

流淌的心,怎能阻拦,吹来的风,又怎能阻挡。

C语言学习三

Jacob posted @ Apr 07, 2017 11:38:10 PM in C语言 with tags C语言 哈工大 小白进阶 , 1730 阅读

二元一次方程解法

#include<stdio.h>
#include<math.h>
#define eps 1e-6
main()
{
    float a,b,c,d;
    printf("Please enter the coefficients a,b,c:");
    scanf("%f,%f,%f",&a,&b,&c);
    if(a==0)
    printf("It is not a quadratic equation!\n");
    else
    {
        d=sqrt(fabs(b*b-4*a*c));
        if(fabs(b*b-4*a*c)<eps)
        printf("x1 = x2 = %.2f\n",(-b+d)/2/a);
        else if(b*b-4*a*c>eps)
        printf("x1 = %.2f, x2 = %.2f\n",(-b+d)/2/a,(-b-d)/2/a);
        else
        printf("x1 = %.2f+%.2fi, x2 = %.2f-%.2fi\n",-b/2/a ,d/2/a ,-b/2/a ,-d/2/a);
    }
}

注意:在这个程序中,最好不要用pow函数

因为:pow是有精度损失的

          计算机没这么聪明,能判断出你的是int型pow,计算机全部当double处理了

pow(2,2) = 3.999999999
pow(2,2) + 0.05 = 4.0499999
然后强制转化就会成为4了

eg

for(i=1;i<=  (int)(pow(m,1.0/3)+0.05); i++)

附上第一次的麻烦代码:

#include<stdio.h>
#include<math.h>
#define   EPS 1e-6
#include "windows.h"
main()
{
    float a,b,c;
    float d;
    printf("Please enter the coefficients a,b,c:");
    scanf("%f,%f,%f",&a,&b,&c);
    d=sqrt(b*b-4*a*c);
    if(a==0)
    printf("It is not a quadratic equation!\n");
    else{
    if(b*b-4*a*c==0)
    printf("x1 = x2 = %.2f\n",(-b+d)/(2*a));
    else if(b*b-4*a*c>0)
    printf("x1 = %.2f, x2 = %.2f\n",(-b+d)/(2*a),(-b-d)/(2*a));
    else
    printf("x1 = %.2f+%.2fi, "  "x2 = %.2f-%.2fi\n",-b/(2*a),sqrt(fabs(b*b-4*a*c))/(2*a),-b/(2*a),sqrt(fabs(b*b-4*a*c))/(2*a));
         
    }


 

Avatar_small
roblox robux 说:
2018年8月24日 17:36

Nice post buddy keep it up friend.

Avatar_small
Jacob 说:
2018年11月07日 15:42

@roblox robux: thanks!

Avatar_small
Mike 说:
2020年4月23日 04:20

This write-up was created by a genuine thinking author without a doubt. I settle on most of them with the strong points made by the author. I'll be back day in and also day for further brand-new updates. Funny Wifi Names 2020

Avatar_small
Matt 说:
2020年4月28日 05:19

Normal sees noted here are the easiest technique to appreciate your energy, which is why I am going to the web site on a daily basis, looking for new, fascinating information. Thanks!

Avatar_small
Ric Thomas 说:
2020年5月01日 08:57

Wonderful task right here on. I review a great deal of post, but I never heard a topic like this. I Love this subject you made concerning the blog owner's container list. Very clever.  kbc winner

Avatar_small
Ric Thomas 说:
2020年5月02日 05:15

Think it or not,
it is the kind of information I've long been attempting to find.
It matches my requirements a lot.
Thanks for writing this details.  jio lottery winner,kbc lottery

Avatar_small
Ric Thomas 说:
2020年5月02日 20:11

Efficiently composed details. It will certainly pay to anyone that uses it, counting me.
Maintain the good work.
For sure I will certainly examine out even more posts a day in and day out.  jio lottery winner

Avatar_small
Ric Thomas 说:
2020年5月08日 03:36

I read a whole lot of blog messages,

but I never heard a topic like this. I review a great deal of blog posts,

but I never ever listened to a topic like this. Positive website,

where did u come up with the information on this publishing?

I just stumbled upon your weblog as well as desired to claim that I have actually delighted in browsing your blog articles.

Positive site, where did u come up with the information on this uploading? assignment代写

Avatar_small
Ric Thomas 说:
2020年5月08日 14:12

Fabulous message, you have signified out some amazing points, I furthermore assume this s a very terrific website. I will certainly check out again for even more quality web content and also, recommend this site to all. Thanks. kbc head office number

Avatar_small
Ric Thomas 说:
2020年5月08日 15:10

Your job is really appreciated round the clock and also the world.
It is a unbelievably comprehensive and also practical blog site.  kbc winner

Avatar_small
Ric Thomas 说:
2020年5月08日 15:15

Successfully written info.
For specific I will certainly assess out more posts a day in as well as day out. kbc lottery winner

Avatar_small
Ric Thomas 说:
2020年5月08日 15:55

I truly took pleasure in analysis this post, huge fan. Keep up the excellent job and please tell me when can you release a lot more short articles or where can I find out more on the subject? kbc lottery

Avatar_small
Ric Thomas 说:
2020年5月09日 15:46

Terrific work below on. I read a great deal of article, yet I never ever listened to a topic such as this. I Love this subject you made about the blog owner's bucket checklist. Really resourceful. assignment代写

Avatar_small
Ric Thomas 说:
2020年5月11日 21:00

Thanks for sharing wonderful information with us. I like your message and all you show to us depends on date as well as quite interesting, I would love to bookmark the page so I can come here once more to read you, as you have actually done a remarkable task. kbc

Avatar_small
Ric Thomas 说:
2020年5月11日 21:03

Outstanding article. Many thanks to this blog site my expedition has ended. kbc live

Avatar_small
Ric Thomas 说:
2020年5月11日 21:14

No question this is an outstanding blog post I got a great deal of understanding after checking out best of luck. The motif of the blog site is outstanding there is almost every little thing to check out, Brilliant blog post. kbc lottery winner

Avatar_small
Ric Thomas 说:
2020年5月11日 21:20

Wonderful blog! I'm intending to start my very own site soon yet I'm a little lost on every little thing. Many thanks! kbc game

Avatar_small
Andrew Strauch 说:
2020年5月24日 10:41

Routine check outs noted here are the simplest method to appreciate your energy, which is why I am going to the internet site daily, looking for brand-new, intriguing information. Thank you! kbc head office number

Avatar_small
Andrew Strauch 说:
2020年5月24日 11:53

I appreciate this write-up for the well-researched content and exceptional wording. I got so interested in this material that I couldn't quit reading. Your blog site is really impressive. kbc winner

Avatar_small
Andrew Strauch 说:
2020年5月24日 14:30

Hey,
what a fantastic post I have come throughout and also thought me
I have actually been seeking for this comparable kind of article for past a week and also rarely discovered this.
Thanks really much and also I will certainly search for even more postings from you.  kbc helpline number

Avatar_small
Andrew Strauch 说:
2020年5月24日 14:34

I got way too much interesting things on your blog.
I guess I am not the just one having all the pleasure right here!
Maintain the great.  kbc customer care number

Avatar_small
Andrew Strauch 说:
2020年5月24日 14:37

Believe it or otherwise,
it is the sort of details I've long been trying to locate.
It matches my needs a great deal.
Thank you for creating this info.  kbc winner list

Avatar_small
Andrew Strauch 说:
2020年5月25日 14:31

Regular check outs noted here are the simplest method to value your energy,
which is why I am going to the site each day, looking for new,
intriguing details. Thank you!  best email marketing platform

Avatar_small
Andrew Strauch 说:
2020年5月28日 11:49

Fabulous post, you have actually represented out some amazing factors, I furthermore believe this s a really wonderful internet site. I will see again for more quality web content and likewise, advise this site to all. Thanks. jio lottery 2020

Avatar_small
Andrew Strauch 说:
2020年5月28日 11:51

Positive website, where did u think of the information on this posting? I have checked out a few of the posts on your website currently, as well as I truly like your style. Many thanks a million as well as please maintain up the efficient work. kbc winner 2020

Avatar_small
Andrew Strauch 说:
2020年6月05日 06:40

Excellent message. I was constantly inspecting this blog site, and I'm amazed! Incredibly useful details specially the last part, I look after such details a whole lot. I was discovering this specific information for a very long time. Many thanks to this blog my expedition has actually ended. kbc winner list

Avatar_small
Andrew Strauch 说:
2020年6月05日 07:42

Truly pleased! Whatever is very clear and also really open information of concerns. It consists of true realities. Your web site is very important. Many thanks for sharing. kbc lottery winner

Avatar_small
Andrew Strauch 说:
2020年6月05日 09:44

You really make it look so simple with your performance but I discover this matter to be actually something which I think I would certainly never comprehend. It seems extremely wide and as well challenging for me. I'm looking ahead to your following post, I'll attempt to obtain the hang of it! kbc contact number

Avatar_small
Andrew Strauch 说:
2020年6月05日 09:49

I review a lot of blog messages, yet I never ever listened to a subject like this. I review a lot of blog articles, yet I never listened to a subject like this. Positive site, where did u come up with the details on this uploading? I just stumbled upon your weblog and wanted to claim that I have actually really delighted in browsing your blog site posts. Positive site, where did u come up with the info on this uploading? kbc lottery winner

Avatar_small
Andrew Strauch 说:
2020年6月05日 10:57

I want you to say thanks to for your time of this terrific read!!! I definitely take pleasure in every little bit of it as well as I have you bookmarked to look into new things of your blog a must-read blog! kbc lottery

Avatar_small
Andrew Strauch 说:
2020年6月05日 11:00

This post was composed by a genuine reasoning writer without a question. I concur on a lot of them with the strong points made by the writer. I'll be back day in and also day for further new updates. kbc winner 2021

Avatar_small
Andrew Strauch 说:
2020年6月05日 11:02

I appreciate this article for the well-researched material and also outstanding wording. I obtained so curious about this material that I couldn't quit checking out. Your blog site is truly impressive. jio lottery 2021

Avatar_small
Andrew Strauch 说:
2020年6月07日 06:46

It is genuinely a well-researched content as well as outstanding phrasing. I obtained so engaged in this material that I couldn't wait to read. I am amazed with your work and also skill. Thanks. shock collars for large stubborn dogs

Avatar_small
Andrew Strauch 说:
2020年6月12日 10:38

I can not wait to dig deep and also kickoff using sources that I received from you. Your vitality is refreshing. kbc lottery 2021

Avatar_small
Andrew Strauch 说:
2020年6月12日 11:21

I check out a whole lot of blog posts, yet I never listened to a topic like this. I read a whole lot of blog articles, but I never ever heard a topic like this. Favorable site, where did u come up with the details on this uploading? I simply stumbled upon your weblog and wanted to claim that I have truly appreciated surfing your blog articles. Favorable website, where did u come up with the information on this posting? kbc head office number

Avatar_small
Andrew Strauch 说:
2020年6月12日 11:46

Normal check outs listed here are the most convenient method to appreciate your energy, which is why I am going to the website everyday, searching for brand-new, intriguing info. Thank you! jio lottery winner

Avatar_small
Andrew Strauch 说:
2020年6月12日 12:57

This write-up was composed by a real reasoning writer undeniably. I settle on a lot of them with the strong factors made by the author. I'll be back day in and day for more new updates. kbc lottery winner 2021

Avatar_small
Andrew Strauch 说:
2020年6月12日 13:00

I value this post for the well-researched web content and excellent wording. I obtained so curious about this material that I couldn't stop reviewing. Your blog is actually excellent. kbc lucky draw 2021

Avatar_small
Andrew Strauch 说:
2020年6月12日 13:41

Think it or not, it is the type of info I've long been looking for. It matches my needs a great deal. Thanks for composing this info. kbc winner list

Avatar_small
Andrew Strauch 说:
2020年6月12日 13:43

Fantastic job right here on. I check out a great deal of post, however I never ever listened to a subject like this. I Love this subject you made concerning the blogger's pail list. Really resourceful. kbc head office number

Avatar_small
Andrew Strauch 说:
2020年6月15日 06:20

You have done a wonderful work on this article. It's very smart as well as extremely legible. You have even managed to make it reasonable and also simple to read. You have some actual composing ability. Thanks. כאן

Avatar_small
Andrew Strauch 说:
2020年6月24日 05:49

I can not wait to dig deep and also kickoff utilizing resources that I got from you. Your enthusiasm is rejuvenating. roku com link

Avatar_small
Andrew Strauch 说:
2020年7月06日 18:42

I appreciate this write-up for the well-researched content and outstanding phrasing. I obtained so curious about this product that I couldn't quit reading. Your blog site is actually excellent. קמגרה

Avatar_small
Andrew Strauch 说:
2020年7月10日 04:32

Incredible blog post. This isn't normally a horrible blog post and also offers full details. I like to inspect this blog post considering I satisfied such a great deal of new genuine elements concerning it truly. Many thanks, loads. I bookmark your web visit light of I discovered dumbfounding details on your weblog, Thanks for sharing. kbc lucky winner 2021

Avatar_small
Andrew Strauch 说:
2020年7月10日 04:36

Superb blog post. I was always inspecting this blog, and I'm satisfied! Exceptionally helpful information specifically the last part, I care for such information a whole lot. I was discovering this certain info for a very long time. Thanks to this blog site my expedition has actually ended. kbc lottery winner

Avatar_small
Andrew Strauch 说:
2020年7月11日 04:18

I check out a lot of blog site posts, but I never ever heard a topic like this. I read a great deal of blog articles, yet I never heard a subject like this. Favorable website, where did u come up with the information on this publishing? kbc lucky winner

Avatar_small
Andrew Strauch 说:
2020年7月11日 04:24

I simply stumbled upon your weblog and wanted to claim that I have actually really taken pleasure in browsing your blog site articles. Favorable site, where did u come up with the info on this uploading? kbc number

Avatar_small
Andrew Strauch 说:
2020年7月15日 06:50

Fabulous blog post, you have denoted out some great points, I likewise assume this s a really terrific website. I will check out once again for more top quality web content and also, suggest this website to all. Many thanks. how can i check my kbc lottery online?

Avatar_small
Andrew Strauch 说:
2020年7月16日 04:04

I examine your blog every day and try to learn something from your blog site. Thank you and waiting for your new message. kbc lottery check 2021

Avatar_small
Andrew Strauch 说:
2020年7月16日 04:55

Great blog site! Do you have any kind of pointers and hints for aspiring authors? I'm intending to start my own website quickly however I'm a little lost on whatever. Would certainly you propose starting with a complimentary system like WordPress or go with a paid choice? There are numerous options out there that I'm completely overwhelmed. Any type of suggestions? Numerous thanks! 网课代写

Avatar_small
Andrew Strauch 说:
2020年7月16日 04:57

Fabulous article, you have actually denoted out some fantastic factors, I likewise believe this s a very remarkable web site. I will certainly check out once more for more high quality content as well as likewise, advise this site to all. Thanks. paragonpoker

Avatar_small
Andrew Strauch 说:
2020年7月16日 18:54

Successfully written details. For specific I will certainly review out more articles a day in as well as day out. kbc imo lottery result

Avatar_small
Andrew Strauch 说:
2020年7月17日 18:52

Excellent task below on. I review a great deal of article, but I never ever listened to a subject like this. I Love this topic you made regarding the blog owner's pail checklist. Extremely clever. kbc lottery check website

Avatar_small
Andrew Strauch 说:
2020年7月19日 05:16

Favorable website, where did u develop the info on this posting? I have read a few of the posts on your web site now, and also I really like your style. Thanks a million and please maintain up the effective job. Hppoker

Avatar_small
Andrew Strauch 说:
2020年7月19日 05:19

Superb blog post. Many thanks to this blog site my expedition has actually finished. mybestpoker

Avatar_small
Andrew Strauch 说:
2020年7月19日 05:24

Pretty wonderful post. I just came across your weblog as well as desired to say that I have actually taken pleasure in searching your blog posts. After all, I'll be signing up for your feed and I wish you write once again soon! Lexispoker

Avatar_small
Andrew Strauch 说:
2020年7月21日 06:00

Good message yet I was questioning if you could create a little more on this topic? If you might specify a little bit further, I 'd be extremely glad. Appreciate it! Judi Slot Online

Avatar_small
Andrew Strauch 说:
2020年7月26日 04:52

Favorable site, where did u create the info on this publishing? I have actually read a few of the articles on your website currently, and also I really like your design. Many thanks a million as well as please maintain up the reliable work. kbc lottery

Avatar_small
Andrew Strauch 说:
2020年7月26日 04:55

Superb blog post. Many thanks to this blog my expedition has finished. 25 Lakh Jio Lottery Winner List 2020

Avatar_small
Andrew Strauch 说:
2020年7月26日 04:56

Fabulous blog post, you have actually signified out some great points, I likewise believe this s a very fantastic website. I will certainly check out again for even more quality material and additionally, advise this website to all. Thanks. dndpoker

Avatar_small
Andrew Strauch 说:
2020年7月27日 04:57

Extremely informative post! There is a whole lot of info right here that can assist any type of organisation begin with an effective social networking project. kbc lottery winner 2020 june

Avatar_small
Andrew Strauch 说:
2020年7月27日 04:57

The very best write-up I stumbled upon a number of years, create something about it on this page. kbc winner list

Avatar_small
Andrew Strauch 说:
2020年8月08日 22:30

Thank you for this fascinating blog post, I am glad I observed this site on yahoo. 먹튀검증사이트

Avatar_small
Andrew Strauch 说:
2020年8月08日 22:30

Think it or not, it is the sort of details I've long been looking for. It matches my needs a lot. Thank you for composing this details. 먹튀커머스

Avatar_small
Andrew Strauch 说:
2020年8月12日 16:25

I can not wait to dig kickoff as well as deep using sources that I received from you. Your enthusiasm is refreshing. แทงบอลออนไลน์

Avatar_small
Andrew Strauch 说:
2020年9月10日 21:56

The best post I discovered a variety of years, create something regarding it on this page. บุหรี่ไฟฟ้า

Avatar_small
Andrew Strauch 说:
2020年9月24日 03:34

Excellent message however I was wondering if you could compose a bit a lot more on this topic? If you can clarify a little bit more, I would certainly be really thankful. Value it! QR Code Generator

Avatar_small
Andrew Strauch 说:
2020年10月27日 06:13

Thanks for this marvelous post, I rejoice I observed this website on yahoo. radio app

Avatar_small
Andrew Strauch 说:
2020年11月09日 22:21

I'm certain that you will certainly be making an actually valuable location. Good carry out! 卡式台胞證

Avatar_small
Andrew Strauch 说:
2020年11月11日 10:29

I can not wait to dig kickoff and deep making use of resources that I received from you. Your exuberance is rejuvenating. 臺胞證

Avatar_small
Norton Com Setup 说:
2020年11月29日 23:44

norton.com/setup
norton.com/setup enter product key
norton.com/setup activate

Let's help you get the Norton

www.norton.com/setup or norton.com/setup

Form url www.norton.com/setup 2019 directly in the address bar of your browser.
Sign up for your Norton account.
Sign in or Build a new Norton Account
Then enter the key to your Norton product.
Choose to install Norton.
After the Norton Update has been completed, run the installation.
"You're all set up! The Norton is now mounted."

Significant points to be recalled when downloading Norton:
You will use your Norton account for all applications relevant to Norton.
If your product key has been redeemed and you are unable to find Norton apps. You can instal Norton directly on your Norton account.

Avatar_small
Andrew Strauch 说:
2021年1月19日 06:10

Excellent article. Thanks to this blog site my expedition has finished. notes

Avatar_small
Andrew Strauch 说:
2021年4月09日 13:36

Thank you for this fascinating blog post, I rejoice I observed this internet site on yahoo. framing a basement

Avatar_small
Andrew Strauch 说:
2021年5月09日 02:35

I check out a lot of blog posts, however I never listened to a topic like this. I review a lot of blog messages, yet I never ever listened to a subject like this. Positive website, where did u come up with the details on this uploading? I just stumbled upon your blog as well as wanted to say that I have actually really appreciated browsing your blog site articles. Favorable website, where did u come up with the details on this uploading? Relx

Avatar_small
Andrew Strauch 说:
2021年6月24日 04:34

Hey, what a dazzling message I have encountered and also thought me I have actually been finding for this similar sort of message for past a week as well as rarely discovered this. Thank you really much and I will certainly seek even more postings from you. Tech Politics Economy Latest News https://eprimefeed.com/ الإخبارية Life-Style News Fashion News Movie News Sports News

Avatar_small
Andrew Strauch 说:
2021年12月08日 07:23

Really informative post! There is a great deal of info here that can assist any kind of service get going with a successful social networking project. joker123 online

Avatar_small
Andrew Strauch 说:
2021年12月14日 05:46

Outstanding blog post. Thanks to this blog my exploration has actually finished. Normanton Park

Avatar_small
Andrew Strauch 说:
2022年6月18日 08:45

I actually delighted in analysis this message, big fan. Maintain the excellent work as well as please tell me when can you publish much more short articles or where can I learn more on the topic? resume builder


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter