unit 8 test - fNPoly =

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 #include <iostream> using namespace std int main(void) { const int n = 7 int newval = 0 int fArray[n] cout<<"Please enter the first element of the array."<<endl cin>>fArray[0] for(int i=1 i<7 i++) { fArray[i]= fArray[i-1]*3 } for(int i=1 i<7 i++) { cout<<fArray[i]<<endl } } #include <iostream> using namespace std int lDiff(int x,int y) { int laDiff, lbDiff laDiff = x-y lbDiff = y-x if(laDiff>lbDiff) { cout<<laDiff<<endl }else{ cout<<lbDiff<<endl } return 1 } int lDiff(char a, char b) {
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Sheet1 Page 2 int laDiff, lbDiff laDiff = a-b lbDiff = b-a if(laDiff>lbDiff) { cout<<laDiff<<endl }else{ cout<<lbDiff<<endl } return 1 } int main(void) { int x=0 const int f = 9 int nArray[f]={-3,-5,7,8,11,13,-3,8,0} for(int i=0 i<8 i++) { lDiff(nArray[i],nArray[i+1]) } } #include <iostream> #include <ctime> #include <cstdlib> #include <cmath> using namespace std int twoArrays(int g,int f) { int fCo int fNPoly int z = 0 fCo = g+f cout<<"The two added coefficients = "<<fCo<<endl cout<<"Please input an integer value for z"<<endl
Background image of page 2
Sheet1 Page 3 cin>>z
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: fNPoly = fCo*pow(z,5.0)+(fCo*pow(z,4.0))+(fCo*pow(z,3.0))+(fCo*pow(z,2.0))+(fCo*z)+fCo cout<<"The value of the new polynomial with 'z' is: "<<fNPoly<<endl return 1 } int main (void) { srand(time(0)) int r = (rand()%10)-5 int t = (rand()%10)-5 const int s = 6 int aSeries, bSeries = 0 int aArray[s] int bArray[s] for(int i=0 i<6 i++) { aArray[i] = r } for(int i=0 i<6 i++) { bArray[i] = t } int x = 0 int y = 0 cout<<"Please input an integer value of x for the first series."<<endl cin>>x cout<<"Now please input an integer value of y for the second series."<<endl cin>>y aSeries = r*pow(x,5.0)+(r*pow(x,4.0))+(r*pow(x,3.0))+(r*pow(x,2.0))+(r*x)+r bSeries = t*pow(y,5.0)+(t*pow(y,4.0))+(t*pow(y,3.0))+(t*pow(y,2.0))+(t*y)+t cout<<"The sum of the series with 'x' is: "<< aSeries <<endl cout<<"The sum of the series with 'y' is: "<< bSeries <<endl twoArrays(aArray[0],bArray[0]) Sheet1 Page 4 }...
View Full Document

This note was uploaded on 04/13/2010 for the course ME me205 taught by Professor Pryor during the Spring '09 term at University of Texas-Tyler.

Page1 / 4

unit 8 test - fNPoly =

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online