Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Problema 38
#include <stdio.h>
int main(int argc, char ** argv)
{
int jugando = 0;
char c;
while(jugando == 0)
{
int n=0;
printf("Ingrese la cantidad de tiros: ");
scanf("%d", &n);
float coordsX [n];
float coordsY [n];
int puntaje=0;
int i=0;
for(i=0; i<n; i++)
{
printf("(X,Y): ");
scanf("%f,%f", &coordsX[i], &coordsY[i]);
if(coordsX[i] > -1 && coordsX[i] < 1 && coordsY[i] > -1 && coordsY[i] < 1)
{
puntaje += 4;
}
else if(coordsX[i] > -2 && coordsX[i] < 2 && coordsY[i] > -2 && coordsY[i] < 2)
{
puntaje += 3;
}
else if(coordsX[i] > -3 && coordsX[i] < 3 && coordsY[i] > -3 && coordsY[i] < 3)
{
puntaje += 2;
}
else if(coordsX[i] > -4 && coordsX[i] < 4 && coordsY[i] > -4 && coordsY[i] < 4)
{
puntaje += 1;
}
}
printf("Tu puntaje total fue de: %d", puntaje);
printf("\nJugar de nuevo? (S/N): ");
fflush(stdin);
scanf("%c",&c);
if(c == 'S' || c == 's')
{
jugando = 0;
}
else
{
jugando = 1;
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.