1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
#include <iostream>
using namespace std;
#include "svgforpa1.h"
int main() {
int x1=-100, y1, x2, y2,d,c1,c2,c3,c4 ;
cout<<"Enter the degree of the polynomial"<<endl;
cin>>d>> endl;
if (d==3)
cout<<"For the polynomial f(x)=C1*x^3+C2*x^2+C3*x^1+C4, enter C1, C2, C3, C4 in order:"<<endl;
else if (d==2)
cout<<"For the polynomial f(x)=C2*x^2+C3*x^1+C4, enter C2, C3, C4 in order:"<<endl;
else if (d==1)
cout<<"For the polynomial f(x)=C3*x^1+C4, enter C3, C4 in order:"<<endl;
else
cout<<"For the polynomial f(x)=C4, enter C4 :"<<endl;
cin>>c1>>c2>>c3>>c4>>endl;
svgout<<"line"<<0<<1000000<<200<<1000000<<"1 green";
svgout<<"line"<<100<<0<<100<<2000000<<"1 green";
while (x1<100)
{x2=x1+1;
y1=c1*x1*x1*x1+c2*x1*x1+c3*x1+c4;
y2=c1*x2*x2*x2+c2*x2*x2+c3*x2+c4;
svgout << "line" << x1+100 << y1 << x2+100 << y2 << "1 blue";
x1=x1+1;
}
return 0;
}
| |