Bolundut+Alexandru

__**Statistica**__



using namespace std; double medie(int n, int f[]); double mediana(int n, int f[]); double dispersia(int n, int f[]); double abatere(double d); void citire(int &n, int f[]); void afis(int f[]); int main { int n,f[11]={0},i; double d; citire(n,f); afis(f); cout<>n; for(i=0;i>a; f[a]++; } } void afis(int f[]) { int i; for(i=1;i<11;i++) cout<<"nota "<1) return i; int j=i-1; while(f[j]==0) j--; return (i+j)/2; } double dispersia(int n, int f[]) { int i; double s=0,m; m=medie(n,f); for(i=1;i<11;i++) s+=f[i]*(i-m)*(i-m); return s/n; } double abatere(double d) { return sqrtl(d); }
 * 1) include
 * 2) include
 * 3) include

__**GRAFICA RECURSIVA**__


 * 1) include "graphics2.h"

void vrej(int xa, int ya, int l, int n) { if(l>1) { int xb=xa,yb=ya-l; setcolor(BROWN); line(xa,ya,xb,yb); setcolor(GREEN); if(n%2==1) { fillellipse(xa-l/2,(ya+yb)/2,l/2,l/4); setcolor(WHITE); line(xa+l/4,ya-l/4,xa+l/4,ya-3*l/4); line(xa+l/4,(ya-l/4+ya-3*l/4)/2,xa,(ya-l/4+ya-3*l/4)/2); line(xa+l/4,(ya-l/4+ya-3*l/4)/2,xa,(ya-l/4+ya-3*l/4)/2-l/4); line(xa+l/4,ya-l/4,xa,ya-l/4); line(xa+l/4,ya-l/4,xa,ya); circle(xa+l/4,ya-3*l/4-l/8,l/8); delay(100); setcolor(BLACK); line(xa+l/4,ya-l/4,xa+l/4,ya-3*l/4); line(xa+l/4,(ya-l/4+ya-3*l/4)/2,xa,(ya-l/4+ya-3*l/4)/2); line(xa+l/4,(ya-l/4+ya-3*l/4)/2,xa,(ya-l/4+ya-3*l/4)/2-l/4); line(xa+l/4,ya-l/4,xa,ya-l/4); line(xa+l/4,ya-l/4,xa,ya); circle(xa+l/4,ya-3*l/4-l/8,l/8); } else { fillellipse(xa+l/2,(ya+yb)/2,l/2,l/4); setcolor(WHITE); line(xa-l/4,ya-l/4,xa-l/4,ya-3*l/4); line(xa-l/4,(ya-l/4+ya-3*l/4)/2,xa,(ya-l/4+ya-3*l/4)/2); line(xa-l/4,(ya-l/4+ya-3*l/4)/2,xa,(ya-l/4+ya-3*l/4)/2-l/4); line(xa-l/4,ya-l/4,xa,ya-l/4); line(xa-l/4,ya-l/4,xa,ya); circle(xa-l/4,ya-3*l/4-l/8,l/8); delay(100); setcolor(BLACK); line(xa-l/4,ya-l/4,xa-l/4,ya-3*l/4); line(xa-l/4,(ya-l/4+ya-3*l/4)/2,xa,(ya-l/4+ya-3*l/4)/2); line(xa-l/4,(ya-l/4+ya-3*l/4)/2,xa,(ya-l/4+ya-3*l/4)/2-l/4); line(xa-l/4,ya-l/4,xa,ya-l/4); line(xa-l/4,ya-l/4,xa,ya); circle(xa-l/4,ya-3*l/4-l/8,l/8); } delay(10); vrej(xb,yb,l-10,n+1); } }

int main { int driver, mod; initgraph(&driver, &mod, "", 1024, 768);

setcolor(BROWN); line(400,650,500,600); line(600,650,500,600); line(450,650,500,600); line(550,650,500,600); vrej(500,600,100,1);

while(!kbhit); closegraph; return 0; }


 * TEMA (7 feb 2011):**

Se arde o cantitate x dintr-o hidrocarbura (CaHb, a,b - nr.nat.nenule). In urma arderii de degaja un volum v de CO2 si o masa y de apa. Se cunoaste faptul ca hidrocarbura analizata are masa moleculara M. Sa se determine formula moleculara a hidrocarburii. Pe baza acesteia calculati nesaturarea echivalenta si precizati carei clase de hidrocarburi se incadreaza.

using namespace std; const int Mc=12,Mh=1,Mco2=44,Mh2o=18; double carbon(double v) { return Mc*v/22.4; } double hidrogen(double y) { return Mh*2*y/Mh2o; } int cantitati(double &c, int M, double x) { c=c*M/x; return c; } double NE(int a, int b) { return (2*a+2-b)/2; } int test(double ne) { if(ne==(int)ne) return 1; return 0; } int clasa(int ne) { switch(ne) { case 0: cout<<"alcan"; return 0; case 1: cout<<"alchena sau cicloalcan"; return 0; case 2: cout<<"alchina, alcadiena sau cicloalchena"; return 0; case 4: cout<<"arena mononucleara"; return 0; default: cout<<"alta clasa"; } } || int main { int M,a,b; double x,y,v,c,h,ne; cout<<"Masa de hidrocarbura: "; cin>>x; cout<<"Volumul de CO2: "; cin>>v; cout<<"Masa de apa: "; cin>>y; cout<<"Masa molara a hidrocarburii: "; cin>>M; cout<<"a) "; c=carbon(v); h=hidrogen(y); if((c+h)==x) { cout<<"Substanta analizata nu este hidrocarbura."; return 0; } c=cantitati(c,M,x); h=cantitati(h,M,x); a=c/Mc; b=h/Mh; cout<<"C"<<a<<"H"<<b<<endl<<"b) N.E.="; ne=NE(a,b); cout<<ne<<endl; if(test(ne)) cout<<"Hidrocarbura exista."<<endl; else { cout<<"Hidrocarbura nu exista in realitate."; return 0; } clasa(ne); return 0; } ||
 * #include


 * TEMA (11 feb 2011):**

N copii se joaca cu zarurile. Fiecare copil arunca de m ori. Casiga cel care a aruncat de cele mai multe ori cifra 6. In cazul in care sunt mai multi copii care au aruncat de acelasi numar de ori cifra 6, va castiga cel care are suma fetelor aruncate cea mai mare. Daca si in acest caz este egalitate intre copii, castiga cel care a aruncat toate fetele zarului. Se va considera remiza in cazul in care si aceasta conditie este indeplinita de mai multi copii.