Advertisement
Guest User

Untitled

a guest
May 27th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.14 KB | None | 0 0
  1. #include <iostream>
  2. #include <windows.h>
  3. #include <stdio.h>
  4. #include <string.h>
  5. using namespace std;
  6. int main()
  7. { float juego;
  8.  
  9. cout<<" Aqui va el gato que Pater no ha traido :v"<<endl;
  10. cout<<" [1] Juego de Parejas :<"<<endl;
  11. cout<<" [2] Ahorcado x3"<<endl;
  12. cout<<" [3] Preguntas :D"<<endl;
  13. cout<<" [4] Matematicas :3"<<endl;
  14. cout<<" "<<endl;
  15.  
  16. cout<<" Elige el juego";
  17. cin>>juego;
  18. if (juego=1)
  19. {
  20.  
  21. int x1=-1, y1=-1, x2=-1, y2=-1, adivina[4][4];
  22. char tablero[4][4], sw=0;
  23. int i, j, c=0, k=1,ac=0, in=8, n1, n2, u1, u2;
  24. tablero[0][0]='@';
  25. tablero[0][1]='*';
  26. tablero[0][2]='+';
  27. tablero[0][3]='@';
  28. tablero[1][0]='$';
  29. tablero[1][1]='~';
  30. tablero[1][2]='#';
  31. tablero[1][3]='%';
  32. tablero[2][0]='+';
  33. tablero[2][1]='&';
  34. tablero[2][2]='$';
  35. tablero[2][3]='~';
  36. tablero[3][0]='&';
  37. tablero[3][1]='#';
  38. tablero[3][2]='%';
  39. tablero[3][3]='*';
  40. for(i=0; i<4; i++)
  41. {
  42. for(j=0; j<4; j++)
  43. {
  44. adivina[i][j]=k;
  45. k=k+1;
  46.  
  47. }
  48. }
  49. do
  50. { system("cls");
  51. c++;
  52. for(i=0; i<4; i++)
  53. {
  54. cout<<endl<<endl;
  55. for(j=0; j<4; j++)
  56. {
  57. if((x1==i&&y1==j)||(x2==i&&y2==j)||adivina[i][j]==0)cout<<tablero[i][j]<<"\t";
  58. else
  59. cout<<adivina[i][j]<<"\t";
  60.  
  61. }
  62. }
  63.  
  64. cout<<endl<<endl;
  65. cout<<"ACIERTOS= "<<ac<<endl<<endl;
  66. system("pause");
  67. cout<<endl<<"digite numero uno: ";
  68. cin>>n1;
  69. cout<<"digite numero dos: ";
  70. cin>>n2;
  71.  
  72.  
  73. if (n1=n2)
  74. {cout<<"Son el mismo numero campeon, perdiste :3"<<endl;}
  75.  
  76.  
  77.  
  78. for(i=0; i<4; i++)
  79. {
  80. for(j=0; j<4; j++)
  81. {
  82. if(adivina[i][j]==n1)
  83. {
  84. x1=i;
  85. y1=j;
  86. }
  87. if(adivina[i][j]==n2)
  88. {
  89. x2=i;
  90. y2=j;
  91. }
  92. }
  93. }
  94. if(tablero[x1][y1]==tablero[x2][y2])
  95. {
  96. ac=ac+1;
  97. adivina[x1][y1]=0;
  98. adivina[x2][y2]=0;
  99. }
  100.  
  101. if(ac==8||c>=in) sw=1;
  102. }while(sw==0);
  103. if(ac==8)
  104. cout<<"felicidades, pasaste al siguiente juego :3"<<endl;
  105. else
  106. cout<<"su numero de intentos termino "<<endl;
  107. }
  108.  
  109.  
  110. if (juego=2)
  111. {
  112. char palabra[50]=("carloscortez"), rep[100], temp [100];
  113. int longitud = 0, i, j=0, inicial=0, acierto=0, tempo=0, oport=6;
  114. bool repetido=false, ganar=false;
  115.  
  116. class Juego{
  117. private:
  118. char word;
  119.  
  120. public:
  121.  
  122. void Ahorcado(){
  123. do{{
  124. tempo=0;
  125. if(inicial==0){
  126. for(i=0;i<strlen(palabra);i++){
  127. if(palabra[i] == ' '){
  128. temp[i] = ' ';
  129. longitud++;
  130. }
  131. else{
  132. temp[i] = '_';
  133. longitud++;
  134. }
  135. }
  136. }
  137.  
  138. inicial = 1;
  139. temp[longitud] = '\0';
  140. for(i=0;i<strlen(rep);i++){
  141. if(rep[i] == word){
  142. repetido = true;
  143. break;
  144. }
  145. else{
  146. repetido = false;
  147. }
  148. }
  149.  
  150. if(repetido == false){
  151. for(i=0;i<strlen(palabra);i++){
  152. if(palabra[i] == word){
  153. temp[i] = word;
  154. acierto++;
  155. temporal = 1;
  156. }
  157. }
  158. }
  159.  
  160. if(repetido == false){
  161. if(temporal == 0){
  162. oport = oport - 1;
  163. }
  164. }
  165. else{
  166. printf("Esa letra ya fue digitada");
  167. printf("\n\n");
  168. }
  169.  
  170. printf("\n");
  171.  
  172. for(i=0;i<strlen(temp);i++){
  173. printf(" %c ", temp[i]);
  174. }
  175.  
  176. printf("\n");
  177.  
  178. if(strcmp(palabra,temp) == 0){
  179. ganar = true;
  180. break;
  181. }
  182.  
  183. printf("\n");
  184.  
  185. printf("Letras acertadas: %d",acierto);
  186. printf("\n");
  187. printf("Oportunidades restantes: %d",oport);
  188. printf("\n");
  189. rep[j] = word;
  190. j++;
  191. printf("Digita una letra para adivinar la palabra: ");
  192. scanf("\n%c",&word);
  193. }while(oport != 0);
  194. }
  195. };
  196.  
  197. class Imprimir{
  198. private:
  199. string mensaje;
  200. public:
  201. void setmensaje(string a){
  202. mensaje = a;
  203. }
  204. string getmensaje(){
  205. return mensaje;
  206. }
  207. };
  208.  
  209. int main()
  210. {
  211. system("CLS");
  212. rep[0] = ' ';
  213. rep[1] = '\0';
  214.  
  215. Juego Victima;
  216. Imprimir mostrar;
  217.  
  218. Victima.Ahorcado();
  219.  
  220. if(ganar){
  221. printf("\n\n");
  222. mostrar.setmensaje("Adivinaste la palabra ;3");
  223. cout<<mostrar.getmensaje();
  224. }
  225. else{
  226. printf("\n\n");
  227. mostrar.setmensaje("Perdiste?? :< pero puedes volver a intentarlo ");
  228. cout<<mostrar.getmensaje();
  229. }
  230.  
  231. printf("\n\n");
  232. system("PAUSE");
  233. }
  234.  
  235. }
  236. return 0;
  237. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement