This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: COSC1415/1436 Program 2 Page 1 of 2 Name Chintu Patel 8001 C++ Programming Assignment #2 TOPIC: Interactive Input/ValueReturning Functions/Formatting Output VALUE: 10 points DATE DUE: Monday, March 3 Program Statement The quadratic formula is: x = b ± √ b 2 – 4ac 2a Write a program that will input the three coefficients (a, b and c) of a quadratic polynomial ax 2 + bx + c and write the two floating point solutions. Assume that the discriminant (the portion of the formula inside the square root) is nonnegative. The program should also print a label showing all of the input data and the two solutions. Program Specifics: 1. Include a comment after each #include directive indicating what the header file is used for 2. Declare all variables after int main( ) . 3. Declare a string constant for your label border (the line of %’s). You may declare the constant before int main( ) . 4. Include a comment after each constant and variable declaration indicating what the constant or variable represents. 5. Make sure that you prompt the user for each individual piece of data that is entered. 6. Follow C++ conventions for naming constants, variables and functions. 7. Use at least two valuereturning functions to do the calculations. 8. Use valuereturning functions for all calculations. No calculation should appear inside the main function. 9. The values for x should be printed with one decimal point. 10. Include preconditions and postconditions for each function. Write the preconditions and postconditions between the function heading and the function body. 11. Put a comment indicating the declaration section, input section, processing section and output section of your program. Separate the sections with a blank line. 12. The output section of your program should use setw rather than using spaces inside quotation marks. 13. Use indentation so that the program is easy to read. COSC1415/1436 Program 2 Page 2 of 2 Output Include user prompts and user input. The output section of your program should produce output that looks very similar to the following: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Quadratic Formula a = 2 b = 4 c = 16 When adding the discriminant x = 4.0 When adding the discriminant x = 4....
View
Full Document
 Spring '08
 May
 Quadratic Formula, Computer Programming, Decimal, Chintu Patel

Click to edit the document details