DoTT Posted December 24, 2011 Share Posted December 24, 2011 (edited) A trecut ceva timp de cand am mai dat pe forum si de cand am facut ultimul program.. De atunci am mai invatat cate putin si am facut un mic joc de x si 0 pentru scoala... #include<iostream> void main() { std::cout<<"Creator: DoTT @ B-zone Forum"<<std::endl;std::cout<<"[url="http://b-zone.ro/forum/user/4145-dott/"]http://b-zone.ro/forum/user/4145-dott/[/url]"<<std::endl<<std::endl; char cPatrat1 = '1'; char cPatrat2 = '2'; char cPatrat3 = '3'; char cPatrat4='4'; char cPatrat5='5'; char cPatrat6='6'; char cPatrat7='7'; char cPatrat8='8'; char cPatrat9='9'; int iTura = 1; bool bJocTerminat(true); //Joc do{ //Tabla std::cout<<cPatrat1<<"|"<<cPatrat2<<"|"<<cPatrat3<<std::endl; std::cout<<"-+-+-"<<std::endl; std::cout<<cPatrat4<<"|"<<cPatrat5<<"|"<<cPatrat6<<std::endl; std::cout<<"-+-+-"<<std::endl; std::cout<<cPatrat7<<"|"<<cPatrat8<<"|"<<cPatrat9<<std::endl; //Simbol char cSimbol; if (iTura == 1) {cSimbol = 'X'; } else {cSimbol = 'O'; } //Miscari std::cout<<"Tura jucatorului "<<iTura<<", alege o casuta: "; bool bMiscareValida; do{ char cUrmMiscare; std::cin>>cUrmMiscare; bMiscareValida = true; //Verifica miscarea if(cUrmMiscare == '1' && cPatrat1 == '1') {cPatrat1 = cSimbol;} else if(cUrmMiscare == '2' && cPatrat2 == '2') {cPatrat2 = cSimbol;} else if(cUrmMiscare == '3' && cPatrat3 == '3') {cPatrat3 = cSimbol;} else if(cUrmMiscare == '4' && cPatrat4 == '4') {cPatrat4 = cSimbol;} else if(cUrmMiscare == '5' && cPatrat5 == '5') {cPatrat5 = cSimbol;} else if(cUrmMiscare == '6' && cPatrat6 == '6') {cPatrat6 = cSimbol;} else if(cUrmMiscare == '7' && cPatrat7 == '7') {cPatrat7 = cSimbol;} else if(cUrmMiscare == '8' && cPatrat8 == '8') {cPatrat8 = cSimbol;} else if(cUrmMiscare == '9' && cPatrat9 == '9') {cPatrat9 = cSimbol;} else {std::cout<<"Miscare nevalida"<<std::endl; bMiscareValida = false;} }while(!bMiscareValida); bJocTerminat = false; bool bCastig = true; //Castig if(cPatrat1 != '1') { if(cPatrat2 == cPatrat1 && cPatrat3 == cPatrat1) { bJocTerminat = true; } if(cPatrat4 == cPatrat1 && cPatrat7 == cPatrat1) { bJocTerminat = true ; } } if(cPatrat5 != '5') { if(cPatrat1 == cPatrat5 && cPatrat9 == cPatrat5) { bJocTerminat= true;} if(cPatrat2 == cPatrat5 && cPatrat8 == cPatrat5) { bJocTerminat= true;} if(cPatrat3 == cPatrat5 && cPatrat7 == cPatrat5) { bJocTerminat= true;} if(cPatrat4 == cPatrat5 && cPatrat6 == cPatrat5) { bJocTerminat= true;} } if(cPatrat9 != '9') { if(cPatrat6 == cPatrat9 && cPatrat3 == cPatrat9) { bJocTerminat= true;} if(cPatrat8 == cPatrat9 && cPatrat7 == cPatrat9) { bJocTerminat= true;} } if(cPatrat1 != '1' && cPatrat2 != '2 '&& cPatrat3 != '3 '&& cPatrat4 != '4' && cPatrat5 != '5 '&& cPatrat6 != '6 '&& cPatrat7 != '7' && cPatrat8 != '8' && cPatrat9 != '9' && !bJocTerminat) { bJocTerminat = true; bCastig = false; } if(bJocTerminat) { std::cout<<cPatrat1<<"|"<<cPatrat2<<"|"<<cPatrat3<<std::endl; std::cout<<"-+-+-"<<std::endl; std::cout<<cPatrat4<<"|"<<cPatrat5<<"|"<<cPatrat6<<std::endl; std::cout<<"-+-+-"<<std::endl; std::cout<<cPatrat7<<"|"<<cPatrat8<<"|"<<cPatrat9<<std::endl; if(bCastig) { std::cout<<"Joc Terminat"<<std::endl; std::cout<<"Jucatorul "<<iTura<<" a castigat"<<std::endl; } else { std::cout<<"Egalitate"<<std::endl; } } else { if(iTura == 1) {iTura = 2;} else {iTura = 1; } } std::cin.get(); }while(!bJocTerminat); std::cin.get(); } Din moment ce e primul program Visual C++ pe care il uploadez , spuneti-mi va rog daca http://www.2shared.c...xsio.html e tot ceea ce aveti nevoie ca sa functioneze. Daca nu, http://www.2shared.c...PZh6/xsio.html? e arhiva cu toate fisierele. Am incercat sa il fac sa se repete singur , insa nu mi-a reusit , o sa mai lucrez (posibil) la el. Edited June 11, 2017 by eB Teodor 2 Link to comment Share on other sites More sharing options...
Quadro Posted December 25, 2011 Share Posted December 25, 2011 Foarte buna ideea! Programul are mici scapari, dar nu cred ca este important acum sa insisti pe chestii de genu: "daca nu introduci nr corespunzator sa faca asa, asa, etc. Important este ca merge foarte bine si inca odatata te felicit pentru idee. Link to comment Share on other sites More sharing options...
FreeedoM Posted December 26, 2011 Share Posted December 26, 2011 (edited) Scrierea e gresita, sau asa e de la mine Am deschis codul tau cu codeblock's , adica am rescris-o si e o greseala Cu codeblocks nu mil ia cu void main() , dar mil ia cu int main() ... Frumoasa creatia , gg error: '::main' must return 'int' Edited December 26, 2011 by FreedoM9 Link to comment Share on other sites More sharing options...
CukusLupus Posted January 28, 2012 Share Posted January 28, 2012 Mie nu imi merge Link to comment Share on other sites More sharing options...
Cookie Monsta Posted January 29, 2012 Share Posted January 29, 2012 Destul de frumos, felicitari. Link to comment Share on other sites More sharing options...
ExteeL Posted January 30, 2012 Share Posted January 30, 2012 Nu imi merge ! Link to comment Share on other sites More sharing options...
Nizza Posted February 22, 2012 Share Posted February 22, 2012 Imi place asta, te asteptam si cu altele! Link to comment Share on other sites More sharing options...
EnZo2011 Posted February 27, 2012 Share Posted February 27, 2012 cool gg Link to comment Share on other sites More sharing options...
WorldDistroyer Posted March 17, 2012 Share Posted March 17, 2012 Frumusica , felicitari mai ales pentru efort Link to comment Share on other sites More sharing options...
FlayTheFlay Posted March 18, 2012 Share Posted March 18, 2012 DoTT, nici mie nu im merge, de ce ? Link to comment Share on other sites More sharing options...
Gangam StyLe ReNnNu xD Posted August 29, 2012 Share Posted August 29, 2012 Acum il incerc si eu. sper sa merite. Felicitari si o seara placuta ! Link to comment Share on other sites More sharing options...
5061756C Posted September 20, 2012 Share Posted September 20, 2012 E foarte fain, data viitoare incearca sa faci cu interfata daca tot folosesti visual c++ incearca .NET / vb Link to comment Share on other sites More sharing options...
meiKo Posted September 20, 2012 Share Posted September 20, 2012 Interesant,un joculet util pentru combaterea plictiselii. Link to comment Share on other sites More sharing options...
Recommended Posts