Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // main.c
- // prog5_integral
- //
- // Created by James Moriarty on 10/24/16.
- // Copyright © 2016 James Moriarty. All rights reserved.
- //
- #define _CRT_SECURE_NO_WARNINGS
- #include <stdio.h>
- #include "prog5_functions.h"
- int main() {
- //a low point, b hi n is number of trapezoids junk clears line
- char junk;
- float a,b,n;
- int nval;
- char yn;
- double area_final;
- while(nval!=2) // loop repeats until nval=2 which is proper format
- do{
- printf("Enter endpoints of interval to be imtegrated <low hi>: ");
- nval=scanf("%f %f",&a, &b);
- printf("\nEnter the number of trapezoids to be used: ");
- scanf("%f", &n);
- if (nval==2 && a<b && n>=1)
- break;
- // other wise clears line
- else if (a>b)
- printf("Error: low < hi \n");
- else if (n<1)
- printf("Error numT must be >1");
- do {
- scanf("%c", &junk);
- } while (junk != '\n');
- } while (nval!=2);
- // unsure what to set return to to rerun prog.
- return(0);
- // not sure if I am calling integrate correctly.
- double integrate ();
- area_final = integrate (a,b,n);
- printf("Evaluate another integral <Y/N>?");
- scanf("%c", &yn);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement