Hello, I need this program to work in Visual C++, Visual Studios 2015 please, Cr
ID: 3837598 • Letter: H
Question
Hello, I need this program to work in Visual C++, Visual Studios 2015 please,
Create a program to solve the integral of a function using Simpsons rule. The upper and lower limits will be positive and the value of n must be even. The user will be requested to select witch function to solve from the following choices:
1)You are given the following three mathematical functions:
a) 1/(1+x2)
b) ex^2
1)The “main” function request the user to select one of the mathematical functions above that they would like to solve. The “main” function will also request the upper and lower limits along with the value of n.
2) You must have a separate function that calculates (delta x)/3.
3) You must have a separate function that calculates the series in Simpsons rule
(f0 + 4 f1 ……….+4fn-1 +fn)
4) You will need a function that completes the overall calculation and prints out the solution. It should also print which function was solved, the upper and lower limits along with the value of n . Provided that n is large enough the answer to the integral of the function should be accurate to three decimal places.
Thank you ahead of time! (This one is a tough one)
Explanation / Answer
#include<iostream>
#include<cstdio>
#include<cstdlib>
using namespace std;
/*
* Node Declaration
*/
struct node
*start, *last;
int counter = 0;
/*
* category Declaration
*/
class double_clist
begin = NULL;
last = NULL;
}
};
/*
* Main: Contains Menu
*/
int main()
worker = new(struct node);
temp->info = value;
temp->next = NULL;
temp->prev = NULL;
come temp;
}
/*
*INSERTS component AT starting
*/
void double_clist::insert_begin()
{
int value;
cout<<endl<<"Enter the component to be inserted: ";
cin>>value;
struct node *temp;
temporary worker = create_node(value);
if (start == last && begin == NULL)
{
cout<<"Element inserted in empty list"<<endl;
begin = last = temp;
start->next = last->next = NULL;
start->prev = last->prev = NULL;
}
else
{
temp->next = start;
start->prev = temp;
begin = temp;
start->prev = last;
last->next = start;
cout<<"Element inserted"<<endl;
}
}
/*
*INSERTS ELEMNET ultimately
*/
void double_clist::insert_last()
{
int value;
cout<<endl<<"Enter the component to be inserted: ";
cin>>value;
struct node *temp;
temporary worker = create_node(value);
if (start == last && begin == NULL)
{
cout<<"Element inserted in empty list"<<endl;
begin = last = temp;
start->next = last->next = NULL;
start->prev = last->prev = NULL;
}
else
}
/*
*INSERTS component AT POSITION
*/
void double_clist::insert_pos()
{
int value, pos, i;
cout<<endl<<"Enter the component to be inserted: ";
cin>>value;
cout<<endl<<"Enter the postion of component inserted: ";
cin>>pos;
struct node *temp, *s, *ptr;
temporary worker = create_node(value);
if (start == last && begin == NULL)
{
if (pos == 1)
{
begin = last = temp;
start->next = last->next = NULL;
start->prev = last->prev = NULL;
}
else
ptr->next = s->next;
s->next->prev = ptr;
if (pos == counter)
counter--;
free(s);
cout<<"Element Deleted"<<endl;
}
/*
* Update price of a selected node
*/
void double_clist::update()
{
int value, i, pos;
if (start == last && begin == NULL)
s->info = value;
cout<<"Node Updated"<<endl;
}
/*
* Search component within the list
*/
void double_clist::search()
zero, value, i;
bool flag = false;
struct node *s;
if (start == last && begin == NULL)
last = start;
begin = p1;
cout<<"List Reversed"<<endl;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.