Balea+Ovidiu


 * =//Pagina de teme- Balea Ovidiu//=

Grafica

using namespace std;
 * 1) include "graphics2.h"
 * 2) include

void fulg { int k = rand%2 + 1; setfillstyle(SOLID_FILL,WHITE); fillellipse(rand%1024,rand%768,k,k); delay(100); fulg;

} void brad2(int xa,int ya,int xb,int yb) { setfillstyle(9,2); bar(xa,ya,xb,yb); yb=ya; xa=xa+2; ya=ya-5; xb=xb-2; delay(50); if(xa150) brad(xa,ya-7,xb-2,yb-7); } void brad1(int xa, int ya, int xb ,int yb) { setcolor(2); delay(50); line(xa,ya,xb,yb); if(yb>150) brad1(xa+2,ya-7,xb,yb-7); } int main { int driver, mod; initgraph(&driver, &mod, "", 1024, 768); setfillstyle(8,9); bar(700,300,900,500); setfillstyle(11,6); bar(770,425,830,500); setfillstyle(4,14); bar(720,325,780,390); setfillstyle(5,14); bar(820,325,880,390); setcolor(RED); setlinestyle(DOTTED_LINE,5,THICK_WIDTH); line(800,170,680,310); line(800,170,920,310); setcolor(6); setfillstyle(11,6); fillellipse(800,250,40,50); setfillstyle(11,2); fillellipse(830,250,7,3); setfillstyle(8,BROWN); bar(490,400,510,460); brad2(400,400,600,410); setlinestyle(DOTTED_LINE,5,THICK_WIDTH); setfillstyle(9,BROWN); bar(246,150,254,500); brad(250,455,350,470); brad1(150,470,250,455); setcolor(WHITE); fulg; while( !kbhit ); closegraph; return 0; }

Tema 8 februarie 2011:*compuneti o problema care sa contina subprogram si rezolvati-o Scrieti un subprogram care sa calculeze concentratia procentuala a unei solutii cunoscandu-se masa solutiei si masa dizolvata,care se citesc de la tastatura.(Balea Ovidiu)

using namespace std; double concentratia(double s,double d) {double c,f; c=d/s*100; return c; } int main {int s,d; cout<<"dati masa solutiei"; cin>>s; cout<<"dati masa dizolvata"; cin>>d; cout<<"concentratia procentuala pentru aceste mase este:"; cout<>n; cout<<"dati cifra c:"; cin>>c; cout<<s(n,c); return 0; }
 * 1) include

Tema 14 februarie 2010: Compuneti o problema cu zaruri Doi copi se joaca un joc cu doua zaruri.La inceput fiecare primeste cate un zar cu care arunca. Dupa aceasta aruncare fiecare copil are dreptul la tot atatea aruncari, cu ambele zaruri, cat valoarea primei aruncari. Castiga cel care aduna punctele cele mai multe. (prima aruncare nu se noteaza)

int vocale(char a[100]) {char *p; int v=0; for(p=a;*p;p++) if(strchr("aeiouAEIOU",*p)) v++; return v; }

void palindrom(char a[]) {int i=0,j,ok=1; j=strlen(a)-1; while(i<j) {if(a[i]!=a[j]) ok=0; i++; j--; } if(ok==1) cout<<"palindrom"; else cout<<"nu e palindrom"; }

int suma(char a[]) {int i,n,s=0; n=strlen(a); for(i=0;i<n;i++) if(isdigit(a[i]) s=s+a[i]-'0'; return s; } int main {char a[100]; while(fin.getline(a,100)) fout<<a<<" "<<vocale(a)<<";"<<suma(a); palindrom(a); }