Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as C++ by 12 ( 14 years ago )
#include <iostream>
#include <fstream>
#include <list>

using namespace std ;
int n = 7 ;
int mas[7] = { 4, 5, 6, 4, 6, 7, 2 } ;

class polynom {
protected:
 int koef ;
 int num ;
public:
 polynom ( ) {
  koef = 0 ;
  num = 0 ;
 }

 polynom (int Koef, int Num) {
  koef = Koef ;
  num = Num ;
 }

 void writepolynom ( int NewKoef, int NewNum ) {
  koef = NewKoef ;
  num = NewNum ;
 }
 void printPolynom () {
  cout << koef << "X" << num ;
 }

 void Calculate ( int rez, int j ) {
  rez = koef*mas[j] ;
 }
} ;

class mult {
 polynom poly ;
 int value ;
public:
 mult (): poly(0,0) { 
  value = 0;
 }

 mult ( int NewKoef, int NewNum, int NewValue   ) {
  poly.writepolynom( NewKoef, NewNum ) ;
  value = NewValue ;

 }

 void writemult (int NewKoef, int NewNum, int NewValue ) {
  poly.writepolynom( NewKoef, NewNum ) ;
  value = NewValue ;
 }

 void printMult () {
  poly.printPolynom( ) ;
  //cout << "=" << value ;
 }
 void calculateValue( int Rez, int j ) {
  value += poly.Calculate( Rez, j ) ; 
 }
} ;

int main () {
 setlocale ( LC_ALL, "Russian" ) ;
 /*list<mult> L ;
 list<mult>::iterator i ;
 list<polynom> M ;
 list<polynom>::iterator j = i->poly.koef ;*/
 list<mult> L ;
 list<mult>::iterator i = L.begin() ;
 int x ;
 for ( int i = 0 ; i < n ; i++ ) {
  cin >> x ;
  L.push_back(mult(x, i, 0)) ;
 }


 system &#40;"Pause"&#41; ;
 return 0 ;
}

 

Revise this Paste

Your Name: Code Language: