1 / 4
Dec 2018

Create struct:

struct Animal which has:

  • ID // ID of hero
  • name // name of animal (char *) (cin.getline) (cin.ignore())
  • strength(int) // power of animal
  • frequency // number of hits in one iteration
  • HP // amount of life

Your task is to show animal which won most rounds in the game.

Input:
n (how many animals) [2 <= n <= 10]
n-times:
ID
name
strength
frequency goals
HP goals
Output:
winner with amount of victory.

Example:

Input:
10
1 Lion John 30 2 100 // (0 1 0 0 1 0 1 0 0) 3 victory
2 Hen Rebecca 60 1 200 // (1 1 1 0 1 0 1 0 1) 6 victory
3 Tiger Alex 40 2 100 // (1 0 0 0 1 0 1 0 1) 4 victory
4 Buffalo James 40 3 100 // (1 1 1 0 1 0 1 0 1) 6 victory
5 Elephant Jack 50 1 300 // (1 1 1 1 1 0 1 0 1) 7 victory
6 Rhino Michael 30 1 200 // (1 0 0 0 0 0 1 0 0) 2 victory
7 Snake Oz 50 2 400 // (1 1 1 1 1 1 1 1 1) 9 victory
8 Cow Bettie 40 1 100 // (0 0 0 0 0 0 0 0 0) 0 victory
9 Crocodile Nick 20 3 500 // (1 1 1 1 1 1 0 1 1) 8 victory
10 Bear Drake 40 2 150 // (1 1 1 1 0 1 0 1 0) 6 victory

Output :
7 Snake Oz 50 2 400 9 victory

  • created

    Dec '18
  • last reply

    Dec '18
  • 3

    replies

  • 745

    views

  • 2

    users