Server IP : 172.16.15.8 / Your IP : 18.223.125.236 Web Server : Apache System : Linux zeus.vwu.edu 4.18.0-553.27.1.el8_10.x86_64 #1 SMP Wed Nov 6 14:29:02 UTC 2024 x86_64 User : apache ( 48) PHP Version : 7.2.24 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0705) : /home/kebuck/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
// Goal: The goal is to write programs in the text to practice loops and // things .... // #include <iostream> #include <iomanip> #incude <cmath> using namespace std; int main() { cout << fixed << showpoint << setprecision(1); float x, y; int a, b, c; char letter; cout << "Do you want to run? (y=yes, q=quit): "; cin >> letter; while( letter != 'q' ) if ( disc > 0 ) { cout << "Input the three integers a, b, and c. "; cin >> a >> b >> c; float disc = b * b - 4.0 * a * c; x = (-b + sqrt( disc ) ) / ( 2.0 * a ); y = (-b - sqrt( disc ) ) / ( 2.0 * a ); cout << "The roots are: " << x << " " << y << endl; } else if ( disc == 0) { x = ( -b + sqrt( disc ) ) / ( 2.0 * a ); cout << "The root is: " << x << endl; } else cout << "No root. \n"; cout << "Do you want to run the program again? (y=yes, q=quit): "; cin >> letter; } return 0; }