zoukankan      html  css  js  c++  java
  • 迭代解方程

    #include <iostream>
    #include <string>
    #include <math.h>
    #include <stdio.h>
    #include <time.h>
    #include <algorithm>
    using namespace std;
    
    struct foo{
    
    	char d;
    };
    
    struct s
    
    {  int x:3;
    
    int y:4;
    
    int z:5;
    
    double a;
    
    };
    
    
    #include <stdio.h>
    
    void main()
    {
    	int N;
    	cin >> N;
    	float x= 1.0;
    	float x0;
    	float f;
    	float f1;
    	do
    	{
    		x0 = x;
    		f = x0 * x0 - N;
    		f1 = 2 * x0;
    		x = x0- f/f1;
    
    	}
    	while (fabs(x -x0) >= 1e-5);
    	cout << x <<endl;
    }
    
  • 相关阅读:
    多线程
    IO
    Collections工具类
    File类
    Map
    List与Set接口
    如何把数学作为一种工具
    包装类
    异常
    内部类
  • 原文地址:https://www.cnblogs.com/liuweilinlin/p/3326351.html
Copyright © 2011-2022 走看看