Sunteți pe pagina 1din 4

Programare Windows I.

Visual C++

Laborator 3

Laborator 3
1) n localitatea X, pentru protecia mediului, autorit ile locale au !ot r"t introducerea unei noi ta#e anuale pentru auto$e!icule. % se scrie o aplicaie &cu inter'a gra'ic ( pentru calculul acestei ta#e )tiind c 'ormula de calcul este* Suma de plat ={ [(A x B x 30%) + (C x D x 70%) x (100 ! ") %#$100% u&de' A + $aloarea combinat a emisiilor de C,-, e#primat .n grame/0m1 B + ta#a speci'ic , e#primat .n euro/2 gram C,-, pre$ 3ut .n 4abelul 2. C + cilindree &capacitatea cilindric (. D + ta#a speci'ic pe cilindree, pre$ 3ut .n 4abelul -. " + cota de reducere a ta#ei, pre$ 3ut .n 4abelul 3. 4abel 2* 5i$elul ta#ei speci'ice 'unc6ie de emisia de dio#id de carbon (orma de poluare "m)*)a de d)ox)d de +arbo& (,rame C-.$/m) 7ibride, electrice, 8uro 9 : 8uro<, 8uro =, 8uro 3 >+2-; 2-2:-2; -22:-?; @+-?2 8uro -, 8uro 2, 5on:8uro : 2abel .' ()0elul taxe) *pe+)1)+e 3& 1u&+4)e de &orma de poluare (orma de poluare Capa+)tatea +)l)&dr)+ (+m+) 7ibride, electrice, 8uro 9 : 8uro< >+-;;; @+-;;2 8uro= >+-;;; @+-;;2 8uro3, 8uro -, 8uro 2, 5on:8uro >+-;;; @+-;;2 4abel 3* 5r)la de redu+ere a taxe) 3& 1u&+4)e de 0e+6)me 7e+6)mea auto0e6)+ululu) Cota de redu+ere (%) nou ; > 2 an 2; > 3 ani 3; > < ani =; > 2; ani 9; Peste 2; ani A; 2 ()0elul taxe) *pe+)1)+e (euro$1 ,ram C-.) ; ; 2 = A 29 ()0elul taxe) *pe+)1)+e (euro$1 +m+) ; 2,3 ;,3B ;,23 3 B 29

Programare Windows I. Visual C++ .) % se reali3e3e un Coc cu o inter'a asem n toare celei din imaginea de mai Cos . Instructiuni*

Laborator 3

la inceput numerele de la 2 la A sunt a)e3ate in mod aleatoriu1 dac se d clic0 pe un num r $ecin cu patratul ro)u &a'lat pe aceea)i linie sau aceea)i coloan (, se sc!imb po3iia num rului respecti$ cu cea a p tratului ro)u1 c"nd numerele sunt ordonate cresc tor iar p tratul ro)u este ultimul &linia 3, coloana 3( se $a a'i)a mesaCul DEelicitariFFFD.

%oluie* Vom 'olosi B butoane cu numele* button1, button2, button3, button4, button5, button6, button7, button8, button9 a c ror proprietate FlatStyle este Flat.

Programare Windows I. Visual C++


array<int,2>^ a; int x0,y0;//folosite pentru a memora pozitia campului liber void joc_nou !" for int i#0;i<$;i%%! for int j#0;j<$;j%%! a&i,j'#i($%j; x0#0; y0#0; )andom^ r#*cne+ )andom !; int x,,y,,x2,y2,temp; for int i#0;i<,0;i%%!" x,#r->.ext !/$; y,#r->.ext !/$; x2#r->.ext !/$; y2#r->.ext !/$; temp#a&x,,y,'; a&x,,y,'#a&x2,y2'; a&x2,y2'#temp; if a&x,,y,'##0!" x0#x,; y0#y,; 0 else if a&x2,y2'##0!" x0#x2; y0#y2; 0 0 scrie !; 0 void scrie_buton 1utton^ b,int nr!" if nr>0!" b->1ac23olor#3olor441lue; b->5ore3olor#3olor446ello+; b->7ext#nr87o9trin* !; 0 else" b->1ac23olor#3olor44)ed; b->5ore3olor#3olor44)ed; b->7ext#::; 0 0 void scrie !" scrie_buton button,,a&0,0'!; scrie_buton button2,a&0,,'!; scrie_buton button$,a&0,2'!; scrie_buton button;,a&,,0'!; scrie_buton button<,a&,,,'!; scrie_buton button=,a&,,2'!; scrie_buton button>,a&2,0'!; scrie_buton button?,a&2,,'!; scrie_buton button@,a&2,2'!; 0

Laborator 3

Programare Windows I. Visual C++

Laborator 3

void muta int x,int y!" if x<0AAx>2!return; if y<0AAy>2!return; if y##y0BBCatD44Ebs x-x0!##,!AA x##x0BBCatD44Ebs y-y0!##,!!" int temp#a&x,y'; a&x,y'#0; a&x0,y0'#temp; x0#x; y0#y; scrie !; if joc_terminat !!" Cessa*e1ox449Do+ :5elicitariFFF:!; 0 0 0 bool joc_terminat !" for int i#0;i<?;i%%! if a&i/$,i/$'F#i%,!return false; return true; 0 private4 9ystem44Goid 5orm,_Hoad 9ystem44Ibject^ sender, 9ystem44JventEr*s^ e! a#*cne+ array<int,2> $,$!; joc_nou !; 0 private4 9ystem44Goid button,_3lic2 9ystem44Ibject^ sender, 9ystem44JventEr*s^ muta 0,0!; 0 private4 9ystem44Goid button2_3lic2 9ystem44Ibject^ sender, 9ystem44JventEr*s^ muta 0,,!; 0 private4 9ystem44Goid button$_3lic2 9ystem44Ibject^ sender, 9ystem44JventEr*s^ muta 0,2!; 0 private4 9ystem44Goid button;_3lic2 9ystem44Ibject^ sender, 9ystem44JventEr*s^ muta ,,0!; 0 private4 9ystem44Goid button<_3lic2 9ystem44Ibject^ sender, 9ystem44JventEr*s^ muta ,,,!; 0 private4 9ystem44Goid button=_3lic2 9ystem44Ibject^ sender, 9ystem44JventEr*s^ muta ,,2!; 0 private4 9ystem44Goid button>_3lic2 9ystem44Ibject^ sender, 9ystem44JventEr*s^ muta 2,0!; 0 private4 9ystem44Goid button?_3lic2 9ystem44Ibject^ sender, 9ystem44JventEr*s^ muta 2,,!; 0 private4 9ystem44Goid button@_3lic2 9ystem44Ibject^ sender, 9ystem44JventEr*s^ muta 2,2!; 0 "

e! " e! " e! " e! " e! " e! " e! " e! " e! "

S-ar putea să vă placă și