IntegralProject - / / / / / / / / / / / / = Name: Gurdip...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
// ============================================================================= // Name: Gurdip Panesar // Course: CMPSC 201 // Project Number: 3 // Project Due Date: 2011 March 31 // Project Filename: integralproject.bpr // Program Filename: integralproject.cpp // Program Execuatable File: integralproject.exe // Output Filename: integralproject.txt // ========================= ================================================== // Program Abstract: This program will use Simpsons and Trapezodal Method to // approximate Integrals with a degree of accuracy at .001 // Input Required: The user should specify a degree of function f(x), the // coefficient of x (no greater than 9), and the upper and // lower bounds of the integral. // Output Desired: The program will output the function chosen by the user, // the integral bounds, table of iteration, and the // approximate answer // ============================================================================= / //headers files #include <conio.h> #include <fstream> #include <iomanip> #include <iostream> #include <math.h> #include <stdlib.h> #include <string> # using namespace std; ofstream fout; o // Global Variable Declarations const char s = 'c'; // This is used in CenterString Function for the screen const char f = 'f'; // This is used in CenterString Function for the Doc. file c // Global Function Declarations char ANSWER (void); // verifys the correctness of the input function void CenterString (int, char); // functins which centers text in fout void CenterPrint (char, int, double []); // functin which center text in cout void enter (void); // function which prompts the user to hit enter to continue v int main () { // Function Declarations const double DOA = 0.001; void Start (void); void DEG (int&); void Bounds (double&, double&); void Output (int&, int, double, double, double, double []); void FxGet (int&, double []); void Solve (double, double, int, double, double []); bool Finish (void); // Variable Declarations double lower, upper, doa;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
double Coef [ 9 ]; int counter, deg; // ========================================================================= // Alphabetized Variable Dictionary // a: midpoint for the partition (Horners Method ) // b: Calculated value which is sent back to the function // (Horners method) // Coef []: Stores constant in an array form. // counter: Creates page break to prompt new page for every integral // entered. // deg: Stores the x^i degree input // delta: partition width // doa: The Degree of Accuracy, stored at 0.001 // fa: Value of lower bounds, calculated using Horner's method // fb: Value of upper bounds, calculated using Horners's method // fx: Value when x is evaluated, calculated using Horner's method // i: integer used in the for loop // j: counter // k: iteration counter // lower: Lower bounds of the integral. // parts: Number of Partions from function
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/03/2011 for the course CMPSC 201 taught by Professor Susanquick during the Spring '08 term at Pennsylvania State University, University Park.

Page1 / 11

IntegralProject - / / / / / / / / / / / / = Name: Gurdip...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online