| |

VerySource

 Forgot password?
 Register
Search
View: 1034|Reply: 8

Rivers and lakes emergency ........ help! C language fast !!!!!!!!! use today !!!!!!!!!!!

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-1-7 00:40:01
| Show all posts |Read mode
1. Make a small program to make the program run as follows
x = 6;
y = ++ x: x = 7, y = 7;
y = x-: x = 6, y = 7;



2. Known: Circle radius R = 1.5 Find: Circumference length and circle area


3. Find the real root of the equation ax ^ 2 + bx + c = 0, a, b, c are entered by the keyboard, a is not equal to 0 and b ^ 2-4ac> 0 (formula method)

4. Solve the root of the equation 2x ^ 3-4x2 + 3x-6 = 0 in the interval (-10, 10) by dichotomy.

5. Solve the equation by iterative method: x ^ 3-x-1 = 0, one near x = 1.5 (represented by six significant figures)


6. Use Newton's iterative method to find equations in C language: 2x ^ 3-4x ^ 2 + 3x-6 = 0 real roots around 1.5



statement:
  I learn chemistry!
  This is for the computer teacher!
  Use today
Reply

Use magic Report

0

Threads

63

Posts

43.00

Credits

Newbie

Rank: 1

Credits
43.00

 China

Post time: 2020-1-7 09:15:01
| Show all posts
will not
Reply

Use magic Report

0

Threads

9

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-1-7 14:00:01
| Show all posts
Let's do it yourself.
Not everyone doesn't help you. It really feels like doing harm to that.
But then again, the key is to see if you are not interested in programming. If you are not interested in programming, it is understandable to write it for you.
This is the case with a friend of mine. He has no interest in C at all, but the C language is hung up and he has to do homework. There was no other way. I wanted to force him to learn what to do by himself. But at first glance, it really doesn't work. He didn't know it at all and wasn't interested. I can't just watch it anyway.
-----------------------------------------------------------------------------------------------------------------------------------
I know a lot of people don't take action when they see posts like LZ. But the problem must be considered comprehensively.
If LZ is really not specializing in programming, there is really nothing to help.
The opposite is absolutely impossible.
Reply

Use magic Report

0

Threads

9

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-1-7 18:36:02
| Show all posts
1.
#include <stdio.h>
#include <conio.h>
void main ()
{
  int x = 6, y;
  printf ("x =% d\n", x);
  y = ++ x;
  printf ("y = ++ x: x =% d y =% d\n", x, y);
  y = x--;
  printf ("y =-x: x =% d y =% d", x, y);
  getch ();
}
----------------------------------------
2.
#include <stdio.h>
#include <conio.h>
#define Pi 3.14
void main ()
{
  float r = 1.5, c, s; / * c is the perimeter and s is the area * /
  c = 2 * Pi * r;
  s = Pi * r * r;
  printf ("c =% f s =% f\n", c, s);
  getch ();
}
Reply

Use magic Report

0

Threads

57

Posts

27.00

Credits

Newbie

Rank: 1

Credits
27.00

 China

Post time: 2020-1-7 21:00:01
| Show all posts
I also studied chemistry. At the beginning (3 years ago), I only studied VB in school?
Reply

Use magic Report

0

Threads

9

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-1-9 12:27:01
| Show all posts
3. Find the real root of the equation ax ^ 2 + bx + c = 0, a, b, c are entered by the keyboard, a is not equal to 0 and b ^ 2-4ac> 0 (formula method)

#include <stdio.h>
#include <conio.h>
#include <math.h>
#define Pi 3.14
void main ()
{
  int a, b, c;
  double x1, x2, s;
  printf ("Input a, b, c:\n");
  scanf ("% d% d% d",&a,&b,&c);
  while (a == 0 || (b * b-4 * a * c) <= 0) / * If the input is illegal, return and enter again
  {
printf ("Input a, b, c error!\nInput a, b, c again:\n");
scanf ("% d% d% d",&a,&b,&c);
  }
  s = b * b-4 * a * c;
  x1 = ((-b) + sqrt (s)) / (2.0 * a);
  x2 = ((-b) -sqrt (s)) / (2.0 * a);
  printf ("% dx ^ 2 +% dx +% d = 0\n", a, b, c); / * show equation * /
  printf ("x1 =% f x2 =% f\n", x1, x2);
  getch ();
}
Reply

Use magic Report

0

Threads

9

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-1-9 13:09:02
| Show all posts
There is no time to write today. LZ wait for someone else.
Reply

Use magic Report

0

Threads

41

Posts

28.00

Credits

Newbie

Rank: 1

Credits
28.00

 China

Post time: 2020-1-9 14:45:01
| Show all posts
If it's just a graduation certificate, there's nothing to help you.
But if you plan to study in this major, it is better to study
The future will inevitably require some mathematical or programming stuff.

俺 Mathematics is not good, you can't do 4, 5, 6
Reply

Use magic Report

0

Threads

9

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-1-10 21:09:01
| Show all posts
I just took the time to write the fourth question
// 4. Solve the root of the equation 2x ^ 3-4x2 + 3x-6 = 0 in the interval (-10, 10) by dichotomy.

#include <stdio.h>
#include <conio.h>

double f (double x)
{
    double y;
    y = 2 * x * x * x-4 * x * x + 3 * x-6;
    return (y);
}

void main ()
{
    double t, a = -10.0, b = 10.0, temp;
    t = (a + b) /2.0;
    while ((f (b) -f (a))> 1e-12) / * error range * /
    {
        t = (a + b) / 2;
        temp = f (t);
        if (temp == 0)
            break;
        else if (temp <0)
            a = t;
        else
            b = t;
    }
    printf ("The root of the equation 2x ^ 3-4x2 + 3x-6 = 0 between (-10,10) is% .8f, f (%. 8f) =%. 8f\n", t, t, f (t ));
    getch ();
}
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list