Skip to content

Commit

Permalink
1865 C
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasPLopes committed Dec 23, 2019
1 parent a421f80 commit f7bca2e
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions C/1865.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#include <stdio.h>
#include <string.h>

#define SIZE 15

char *owner = "Thor";

typedef struct
{
char name[15];
int force;
} Hero;

int canPull(Hero *, char *);

int main(int argc, char const *argv[])
{
int times;
Hero hero = {"", 0};

scanf("%d", &times);

for (size_t i = 0; i < times; i++)
{
scanf("%s %d", hero.name, &hero.force);

if (canPull(&hero, owner) == 0)
printf("Y\n");
else
printf("N\n");
}

return 0;
}

int canPull(Hero *h, char *owner)
{
return strcmp(h->name, owner);
}

0 comments on commit f7bca2e

Please sign in to comment.