6. cout<<"| CHOICE MENU |n; "
cout<<"|-----|----|-----------------------------------------------------------|n;"
cout<<"| |(1)-| calculate (Integration )Simpson 'press (1) ' |n;"
cout<<"| --|----|------------------------------------------- |n;"
cout<<"| |(2)-| Draw F(x) 'press (2) ' |n;"
cout<<"| --|----|------------------------------------------- |n;"
cout<<"| |(00)| to Main_Menu.. 'press (00) ' |n;"
cout<<"| --|----|------------------------------------------- |n;"
cin>>q1;
}
void menu(int & y)
{
cout<<"|----------------------------------------------------------------------|n;"
cout<<"| CHOICE MENU |n; "
cout<<"|-----|----|-----------------------------------------------------------|n;"
cout<<"| |(1)-| Put the Xi / Yi 'press (1) ' |n;"
cout<<"| --|----|------------------------------------------- |n;"
cout<<"| |(2)-| print the Lagranj Function for this points 'press (2) ' |n;"
cout<<"| --|----|------------------------------------------- |n;"
cout<<"| |(3)-| Find Pn(b) 'press (3) ' |n;"
cout<<"| --|----|------------------------------------------- |n;"
cout<<"| |(4)-| Draw F(x) 'press (4) ' |n;"
cout<<"| --|----|------------------------------------------- |n;"
cout<<"| |(0)-| to Main_Menu.. 'press (0) ' |n;"
cout<<"|-----|----|-----------------------------------------------------------|n;"
cout<<"|----------------------------------------------------------------------|n;"
cout<<"enter your choice;" :
cin>>y;
}
void main)(
{
//double v1,v2; //for draw domain [v1,v2]
cout.setf(ios::fixed); // to print just 4 numbers after the Point
cout.setf(ios::showpoint;)
cout.precision(2;)
int q; main_menu(q;)
while (q!=0)
{
switch(q)
{
7. case 1{ :
//////////////////////////////////////////////////////Lagranj/////////////////////////////////////////////////////
int n,y; double a[100][100;]
double x;
menu(y); //Print the menu and get choice y
while (y!=0)
{
switch(y)
{
case 1 : { cout<<" How many points?? n;"
cout<<"put the number of points : N= n; "
cin>>n;
fillarr(a,n-1;)
menu(y ;)
break;
}
case 2{ :
cout<<"Two numbers after POINT: ex (0.00) (!!more than 2 may not seen!!! )n;"
print(a,n-1 ;)
menu(y ;)
break;
}
case 3{ :
cout<<"Put the X0 : f(x0)....n"; cin>>x;
cout<<"P"<<n-1<<"("<<x<<") = "<<p(a,n-1,x)<<endl;
menu(y ;)
break;
}
case 4:
{
draw_function(a,n-1;)
menu(y ;)
break;
}
case 0 : { cout<<" :) :) End program My wishes :) :) !! n;"
menu(y ;)
break } ;
default:{ cout<<"Error in choice !!! n ;"
menu(y); //Print the menu and get choice y
8. break} ;
// }switch
cout<<".................................... n;"
}
main_menu(q;)
break;}//case 1
//////////////////////////////////////////////////////Simpson/////////////////////////////////////////////////////
case 2:
{
int q1; double x0,xn; int en; double sum1,sum2;
double f[100][100;]
menu2(q1;)
while (q1!=0)
{
switch(q1)
{
case 1:
{
cout<<" Put the Domain [ X0, Xn ]n;"
cout<<" X0 = "; cin>>x0; cout<<" Xn = "; cin>>xn;
cout<<" Put the NUmber of Domains u want to Divide into them(even) : n"; cin>>en;
if(en %2 !=0) // en isn't Even
{
cout<<"YOUR "<<en<<" is not Even and i will calculat by another way !! n;"
cout<<"simpson(fo -->fn-1) + simpson(fn-1-->fn)n;"
simpson(x0,xn-((xn-x0)/en),en-1,f,sum1); //fo -->fn-1
simpson(xn-((xn-x0)/en),xn,en-1,f,sum2); //fn-1-->fn
cout<<"The Integration fo -->fn-1 = I1 = "<<sum1<<endl;
cout<<"The Integration fn-1-->fn = I2 = "<<sum2<<endl;
cout<<"The Integration = I = "<<sum1+sum2<<endl;
}
else
{
simpson(x0,xn,en,f,sum1;)
cout<<"The Integration = I = "<<sum1<<endl;
}
menu2(q1;)
break;
}