Question
I have submitted this question before and have gotten incorrect responses because they needed to follow the requirements below and did not. Please make sure
I have submitted this question before and have gotten incorrect responses because they needed to follow the requirements below and did not. Please make sure that the code matches what it asks for in the requirements, I know it's a big code to ask, but I want to compare this answer with what I currently have to see where I'm going wrong. This is in the C++ language. Make sure to exclude stdio.h like it says below and that the text files input in the arguments are not hard-coded. Thank you!!!
Overview You are to create a program that computes the roots of the equation ax2 + bx + c = 0 using the Quadratic Formula:
The program shall read lines containing 3 integers representing a, b, and c from an input text file and write the set and its corresponding floating-point roots to either an output text file or the screen. Requirements 1. The program will be done in C++ using Cygwin and g++. You may not use stdio.h. 2. The input file will contain three integers per line, representing values for a, b, and c respectively. Each line of the output file or screen shall contain the set of three integers followed by the two floating-point roots, with all values separated by tabs. All floating-point values shall be printed with 4 digits after the decimal point. If an input set generates complex roots, the output should state complex rather than computing the roots. 3. All integers in the input file will be between -99 and 99. There is no limit to the size of the input file. 4. The output file / screen must print the number sets in the same order as they appear in the input file.
5. The program will expect either 1 or 2 command-line arguments to specify the names of the input and output files. Example command-line input: $ .\qr.exe input.txt output.txt $ .\qr.exe input.txt The output file argument is optional. If it does not appear, output shall be sent to the screen. Remember that the grader will specify the file names; they cannot be hard-coded in your program. 6. Malformed command-line syntax and/or failure to open input or output files shall result in an error message and immediate program termination. 7. Remember function headers and comments! Example Files If the input file appeared like this: 1 20 3 2 -11 5 1 -5 6 3 6 3 4 5 6 1 4 4 The associated output file (or screen) should look like this: 1 20 3 -0.1511 -19.8489 2 -11 5 5.0000 0.5000 1 -5 6 3.0000 2.0000 3 6 3 -1.0000 -1.0000 4 5 6 complex 1 4 4 -2.0000 -2.0000 The output file argument is optional. If it does not appear, output shall be sent to the screen. Remember that the grader will specify the file names; they cannot be hard-coded in your program. 7. Malformed command-line syntax and/or failure to open input or output files shall result in an error message and immediate program termination. 8. A makefile must be used and submitted. Failure to provide a working makefile will result in zero points for successful compilation and execution. 9. Remember function headers and comments! Example Files If the input file appeared like this: 1 20 3 2 -11 5 1 -5 6 3 6 3 4 5 6 1 4 4 The associated output file (or screen) should look like this: 1 20 3 -0.1511 -19.8489 2 -11 5 5.0000 0.5000 1 -5 6 3.0000 2.0000 3 6 3 -1.0000 -1.0000 4 5 6 complex 1 4 4 -2.0000 -2.0000
x=2abb24acStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started