22 by arhiplupuzait

VIEWS: 13 PAGES: 1

									#include<fstream.h> void main(){ ifstream f("pol.in"); int grad,coefpol[100],coefmon,gradmon,coefcat[100],coefrest[100]; f>>grad; for(int i=1;i<=grad+1;i++) f>>coefpol[i]; f>>gradmon; f>>coefmon; for(i=1;i<=grad-gradmon+1;i++) coefcat[i]=coefpol[i]/coefmon; for(int j=1;j<=gradmon;j++) coefrest[j]=coefpol[j+grad-gradmon+1]; ofstream g("pol.out"); g<<"catul este "<<endl; for(i=1;i<=grad-gradmon+1;i++) g<<coefcat[i]<<" X^ "<<grad-gradmon-i+1<<endl; g<<"restul este "<<endl; for(i=1;i<=gradmon;i++) g<<coefrest[i]<<" X^ "<<gradmon-i<<endl; }


								
To top