I have an assignment for my c++ class at college and i wasn't able to go to class for the last week for medical reasons and i was looking for some help...
the assignment is to "Write a program that allows the user to select among built-in functions, an interval, and whether to integrate or differentiate. Make an interface a menu. Use arrays to save function values. "
I was able to spend like 30 mins with a friend and read the book and i was able to come up with this...
#include <iostream>
#include <cmath>
using namespace std;
double riemann(double (*pf)(double t), double a, double b, int n)
{
double s = 0, h = (b-a)/n, x;
int i;
for (x = a, i = 0; i < n; x += h, i++)
s += (*pf)(x);
return s*h;
}
i dont know how to approach the main and work with the arrays, i was able to individually try the functions and they do work but i dont know how to select and interval and save it value... and how to do a UI
Any help would be appreciated,
ty