void main() { Produs mere("Mere",4.1); Produs pere("Pere",6.5); mere++; pere++; mere+=5; cout<<mere<<endl<<pere<<endl; if(mere<pere) cout<<"Valoarea merelor este mai mica"<<endl; else cout<<"Valoarea perelor este mai mica"<<endl; ProdusDiscount struguri("Struguri",8,15); struguri+=10; cout<<struguri<<endl; Cos cos; cos+=&struguri; cos+=&pere; cos+=&mere; cout<<"TOTAL:"<<cos.total()<<endl; ofstream fisier("date_cos.txt"); cos.scrieInFisier(fisier); vector<string> denumiriProduse=cos.obtineDenumiri(); vector<string>::iterator it; for(it=denumiriProduse.begin(); it!=denumiriProduse.end(); it++) cout<<*it<<endl; }
void testCosinus() { // c = cos(PI/3) Cos * c = new Cos(new Constante(M_PI/3.0)); cout << *c << " = " << c->eval() << endl; delete c; cout << "destruction automatique des variables locales allouees sur la PILE: ICI AUCUNE " << endl; }
static RCP<const Basic> diff(const Cos &self, const RCP<const Symbol> &x) { return mul(mul(minus_one, sin(self.get_arg())), self.get_arg()->diff(x)); }
void bvisit(const Cos &x) { apply(result_, *(x.get_arg())); mpfr_cos(result_, result_, rnd_); }