Calculation of a bitterly assigned function with++



  • Сама система уравнений It's simple, but there's little trouble.

    It doesn't work, it's just 0.8, it's cycling and everything.

    #include <iostream>
        #include <stdio.h>
        #include <cmath>
        using namespace std;
    
    int main()
    {
        setlocale(LC_ALL, "ru");
        float a = 0.36, b = 0.7 , c = 0.8;
        for (float x = 0; x &gt;= 0 &amp;&amp; x &lt;= 10; x += 0,5)
        {
            if (x &lt;= 5)
            {
                cout &lt;&lt; a * pow(x, 2) + b * x + c &lt;&lt; endl;
            }
            else if (x &gt; 5 &amp;&amp; x &lt;= 6)
            {
                cout &lt;&lt; exp(x) &lt;&lt; endl;
            }
            else if (x &gt; 6)
            {
                cout &lt;&lt; log(x) &lt;&lt; endl;
            }
        }
        system("pause");
        return 0;
    }
    



  •     #include <iostream>
        #include <stdio.h>
        #include <cmath>
        using namespace std;
        
        int main()
        {
            setlocale(LC_ALL, "ru");
            float a = 0.36, b = 0.7 , c = 0.8;
            float result;
            for (float x = 0; x >= 0 && x <= 10; x += 0.5)
            {
                if (x <= 5)
                {
                    result = a * pow(x, 2) + b * x + c;
                }
                else if (x > 5 && x <= 6)
                {
                    result = exp(x);
                }
                else if (x > 6)
                {
                    result = log(x);
                }
                cout << result << endl;
            }
            
            system("pause");
            return 0;
        }
    


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2