Name: Integral Of Every Terms
Description of the Program: This program displays the integral of each term of expression.
In the screenshot below, I entered 5 terms that I would like to integrate and the five values of coefficients and exponents. Then, it displayed the whole term of expression that I have entered and the integral of the expression in fraction and in decimal.
//Below are the Codes of the Program:
#include <windows.h>
#include <iostream.h>
#include <math.h>
#include <string.h>
#include <cstring.h>
#include <conio.h>
double coeff1[100]={0};
double exponent1[100]={0};
int b;
void dual_swap(double&a,double&b,double&x,double&y)
{double c,d;
c=a;
a=b;
b=c;
d=x;
x=y;
y=d;
}
int main()
{
string num_coeff;
cout<<"How many terms would you like to integrate: "; cin>>b;
for(int x=0;x<b;x++) cout="" {=""><< "\n\nEnter the value of coefficient "<<x+1><<": \t\t"; cin >> coeff1[x];
cout << "\nEnter the value of exponent "<<x+1><<": \t\t"; cin >> exponent1[x];
}
for(int aa=0;aa<b;aa++) as="0;as<b;as++)" for(int="" if(exponent1[as]="" {="">exponent1[as+1]&&as+1<b)>
dual_swap(exponent1[as],exponent1[as+1],coeff1[as],coeff1[as+1]);
}
}
cout << "\n\n\nYou have entered: \n";
for(int x=0;x<b;x++)>
{cout<< coeff1 [x]<< "x^" << exponent1[x];
if(x!=b-1)
cout<< " + ";
}
cout<< "\n\n\nYour new integral in fraction: \n";
for(int x=0;x<b;x++)>
{
cout<<"("<< coeff1[x] << "/" << exponent1[x] + 1<< ")x^" << exponent1[x] + 1;
if(x!=b-1)
cout<< " + ";
}
cout<< "\n\n\nOr in decimal: \n";
for(int x=0;x<b;x++)>
{
cout<<"("<< (coeff1[x]) /(exponent1[x] + 1)<< ")x^" << exponent1[x] + 1;
if(x!=b-1)
cout<< " + ";
}
getch();
return 0;
}
#include <iostream.h>
#include <math.h>
#include <string.h>
#include <cstring.h>
#include <conio.h>
double coeff1[100]={0};
double exponent1[100]={0};
int b;
void dual_swap(double&a,double&b,double&x,double&y)
{double c,d;
c=a;
a=b;
b=c;
d=x;
x=y;
y=d;
}
int main()
{
string num_coeff;
cout<<"How many terms would you like to integrate: "; cin>>b;
for(int x=0;x<b;x++) cout="" {=""><< "\n\nEnter the value of coefficient "<<x+1><<": \t\t"; cin >> coeff1[x];
cout << "\nEnter the value of exponent "<<x+1><<": \t\t"; cin >> exponent1[x];
}
for(int aa=0;aa<b;aa++) as="0;as<b;as++)" for(int="" if(exponent1[as]="" {="">exponent1[as+1]&&as+1<b)>
dual_swap(exponent1[as],exponent1[as+1],coeff1[as],coeff1[as+1]);
}
}
cout << "\n\n\nYou have entered: \n";
for(int x=0;x<b;x++)>
{cout<< coeff1 [x]<< "x^" << exponent1[x];
if(x!=b-1)
cout<< " + ";
}
cout<< "\n\n\nYour new integral in fraction: \n";
for(int x=0;x<b;x++)>
{
cout<<"("<< coeff1[x] << "/" << exponent1[x] + 1<< ")x^" << exponent1[x] + 1;
if(x!=b-1)
cout<< " + ";
}
cout<< "\n\n\nOr in decimal: \n";
for(int x=0;x<b;x++)>
{
cout<<"("<< (coeff1[x]) /(exponent1[x] + 1)<< ")x^" << exponent1[x] + 1;
if(x!=b-1)
cout<< " + ";
}
getch();
return 0;
}