Created
October 26, 2017 12:20
-
-
Save hansen033/62aa6eb7c729fc258fd5e120ac4b10c8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <math.h> | |
using namespace std; | |
int main() | |
{ | |
int a, b, c, m, n, z; | |
cout <<"方程式: y=a*x*x+b*x+c\n"; | |
cout <<"請輸入方程式中的a:\n"; | |
cin >> a; | |
cout <<"請輸入方程式中的b:\n"; | |
cin >> b; | |
cout <<"請輸入方程式中的c:\n"; | |
cin >> c; | |
z=(b/2/a); | |
m=z*-1; | |
n=c-(z*z*a); | |
if (m < 0){ | |
cout <<"你輸入的方程式: y=" << a << "x^2 +" << b << "x+" << c <<"的標準式是: " << a << "(x+" << -m << ")^2 +" << n; | |
} else if (m > 0){ | |
cout <<"你輸入的方程式: y=" << a << "x^2 +" << b << "x+" << c <<"的標準式是: " << a << "(x" << -m << ")^2 +" << n; | |
} else if (m == 0){ | |
cout <<"你輸入的方程式: y=" << a << "x^2 +" << b << "x+" << c <<"的標準式是: " << a << "x" << ")^2 +" << n; | |
} | |
cout <<"\n\n感謝您的使用,再見!"; | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment