SHOW:
|
|
- or go back to the newest paste.
| 1 | #include <stdio.h> | |
| 2 | ||
| 3 | ||
| 4 | const int M = 4; | |
| 5 | const int N = 3; | |
| 6 | const int MAX=80; | |
| 7 | ||
| 8 | typedef char string[MAX]; | |
| 9 | typedef string arregloAmigos[M]; | |
| 10 | typedef string arregloPaises[N]; | |
| 11 | typedef int matriz[M][N]; | |
| 12 | ||
| 13 | int main() | |
| 14 | ||
| 15 | {
| |
| 16 | ||
| 17 | char c; | |
| 18 | int i=0; | |
| 19 | int j=0; | |
| 20 | int k=0; | |
| 21 | ||
| 22 | ||
| 23 | arregloPaises Paises; | |
| 24 | arregloAmigos Grupo1; | |
| 25 | arregloAmigos Grupo2; | |
| 26 | ||
| 27 | ||
| 28 | printf("\nIngresar Paises a competir:\n");
| |
| 29 | for(i=0; i<=N; i++){
| |
| 30 | printf("Pais numero %d ",i+1);
| |
| 31 | j=0; | |
| 32 | scanf("%c",&c);
| |
| 33 | while((c!='\n')&&(j<MAX-1)){
| |
| 34 | Paises[i][j]=c; | |
| 35 | scanf("%c",&c);
| |
| 36 | j++; | |
| 37 | } | |
| 38 | Paises[i][j]='\0'; | |
| 39 | } | |
| 40 | ||
| 41 | printf("\nLos paises ingresados son:\n");
| |
| 42 | for(i=0; i<=N; i++){
| |
| 43 | j=0; | |
| 44 | printf("\nPais numero %d ",i+1);
| |
| 45 | while((Paises[i][j]!='\0')){
| |
| 46 | printf("%c",Paises[i][j]);
| |
| 47 | j++; | |
| 48 | } | |
| 49 | } | |
| 50 | ||
| 51 | ||
| 52 | ||
| 53 | ||
| 54 | printf("\n\nIngresar amigos del Grupo 1:\n");
| |
| 55 | for(i=0; i<=M; i++){
| |
| 56 | printf("Amigo numero %d ",i);
| |
| 57 | j=0; | |
| 58 | scanf("%c",&c);
| |
| 59 | while((c!='\n')&&(j<MAX-1)){
| |
| 60 | Grupo1[i][j]=c; | |
| 61 | scanf("%c",&c);
| |
| 62 | j++; | |
| 63 | } | |
| 64 | Grupo1[i][j]='\0'; | |
| 65 | } | |
| 66 | ||
| 67 | printf("\n\nAmigos del Grupo 1 ingresados son:\n");
| |
| 68 | for(i=0; i<=M; i++){
| |
| 69 | j=0; | |
| 70 | printf("\nAmigo numero %d ",i);
| |
| 71 | while(Grupo1[i][j]!='\0'){
| |
| 72 | printf("%c",Grupo1[i][j]);
| |
| 73 | j++; | |
| 74 | } | |
| 75 | } | |
| 76 | ||
| 77 | ||
| 78 | ||
| 79 | printf("\n\nIngresar amigos del Grupo 2:\n");
| |
| 80 | for(i=0; i<=M; i++){
| |
| 81 | printf("Amigo numero %d ",i);
| |
| 82 | j=0; | |
| 83 | scanf("%c",&c);
| |
| 84 | while((c!='\n')&&(j<MAX-1)){
| |
| 85 | Grupo2[i][j]=c; | |
| 86 | scanf("%c",&c);
| |
| 87 | j++; | |
| 88 | } | |
| 89 | Grupo2[i][j]='\0'; | |
| 90 | } | |
| 91 | ||
| 92 | printf("\n\nAmigos del Grupo 2 ingresados son:\n");
| |
| 93 | for(i=0; i<=M; i++){
| |
| 94 | j=0; | |
| 95 | printf("\nAmigo numero %d ",i);
| |
| 96 | while(Grupo2[i][j]!='\0'){
| |
| 97 | printf("%c",Grupo2[i][j]);
| |
| 98 | j++; | |
| 99 | } | |
| 100 | } | |
| 101 | ||
| 102 | ||
| 103 | ||
| 104 | ||
| 105 | matriz VotacionGrupo1; | |
| 106 | matriz VotacionGrupo2; | |
| 107 | ||
| 108 | printf("\nIngreso de votos\n");
| |
| 109 | for(i=0; i<=M; i++){
| |
| 110 | printf("Ingresar votos de amigo ");
| |
| 111 | j=0; | |
| 112 | while(Grupo1[i][j]!='\0'){
| |
| 113 | printf("%c",Grupo1[i][j]);
| |
| 114 | j++; | |
| 115 | } | |
| 116 | printf("\n");
| |
| 117 | ||
| 118 | printf("\nLos paises ingresados son:\n");
| |
| 119 | for(i=0; i<=N; i++){
| |
| 120 | j=0; | |
| 121 | printf("\nPais numero %d ",i+1);
| |
| 122 | while((Paises[i][j]!='\0')){
| |
| 123 | printf("%c",Paises[i][j]);
| |
| 124 | j++; | |
| 125 | } | |
| 126 | } | |
| 127 | ||
| 128 | ||
| 129 | ||
| 130 | // for(k=0; k<=N; k++){
| |
| 131 | // printf(" para pais ");
| |
| 132 | // j=0; | |
| 133 | // while(Paises[k][j]!='\0'){
| |
| 134 | // printf("%c",Paises[k][j]);
| |
| 135 | // j++; | |
| 136 | // } | |
| 137 | // printf(" ");
| |
| 138 | // scanf("%d",&VotacionGrupo1[i][k]);
| |
| 139 | // } | |
| 140 | ||
| 141 | ||
| 142 | ||
| 143 | } | |
| 144 | ||
| 145 | ||
| 146 | ||
| 147 | ||
| 148 | ||
| 149 | ||
| 150 | ||
| 151 | ||
| 152 | ||
| 153 | ||
| 154 | ||
| 155 | // printf("Ingresar amigos del Grupo 2:\n");
| |
| 156 | ||
| 157 | // for(int i=0; i<=M; i++){
| |
| 158 | ||
| 159 | // printf("Amigo numero %d",i);
| |
| 160 | ||
| 161 | // j=0; | |
| 162 | ||
| 163 | // scanf("%c",&c);
| |
| 164 | ||
| 165 | // while((c!='\n')&&(j<MAX-1)){
| |
| 166 | ||
| 167 | // entrada[j]=c; | |
| 168 | ||
| 169 | // j++; | |
| 170 | ||
| 171 | // scanf("%c",&c);
| |
| 172 | ||
| 173 | // } | |
| 174 | ||
| 175 | // entrada[j]='\0'; | |
| 176 | ||
| 177 | // Grupo2[i]=entrada; | |
| 178 | ||
| 179 | // | |
| 180 | ||
| 181 | // } | |
| 182 | ||
| 183 | ||
| 184 | ||
| 185 | ||
| 186 | ||
| 187 | ||
| 188 | ||
| 189 | ||
| 190 | } |