/** Copyright (c) 2011, School of Computer Science, Yantai University * All Rights Reserved. * file name: test. CPP * Author: Fan Lulu * Completion Date: July 15, October 22, 2012 * version number: V1.0 ** input Description: none * Problem description: quadratic function solution *ProgramOutput: Root of quadratic function * Problem Analysis: omitted *AlgorithmDESIGN: slightly */# include <iostream> # include <cmath> using namespace STD; int main () {double A, B, C, x1, x2, D; cout <"Enter the value of A, B, C:"; CIN> A> B> C; D = B * B-4 * a * C; if (! = 0) {If (d <0) {cout <"this function has no real number root. "<Endl;} else if (D = 0) {x1 = x2 =-B/(2 * A); cout <" this function has a real number root: "<X1 <Endl;} else if (D> 0) {x1 = (-B + d)/(2 * A); x2 = (-B-d) /(2 * A); cout <"X1 =" <X1 <Endl; cout <"X2 =" <X2 <Endl ;}} elsecout <"this function is not a quadratic function. ";}
Result 1:
Result 2:
Third result:
Fourth result:
Experience: After the guidance of the teacher, learn how to get the picture out. Haha.