I have to store my input values from function 1 into another array caled namesMore in function 2. Not to sure how to store into second array
#include <iostream>
#include <string>
using namespace std;
const int NR_PLAYERS = 4;
void inputInformation(int goalsP[], int cardsR[], string names[])
{
for(int i =0; i < NR_PLAYERS; i++)
{
cout << "Player: " << names << endl;
cout << "Enter the number of goals scored: ";
cin >> goalsP;
cout << "Enter the number of cards received: ";
cin >> cardsR;
}
}
void findPlayersWithMoreCardsThanGoals(int goalsP[], int cardsR[], string names[])
{
for(int namesMore = 0; namesMore <= NR_PLAYERS; namesMore++)
{
if(cardsR > goalsP)
names = namesMore;
}
}
void displayInfo(string namesMore)
{
cout << "The following Players got more cards than goals: " << namesMore << '\t' << endl;
}
int main( )
{
string names[] = {"Tiny Nakedi", "Cecil Mametsa", "Chris Rooney", "Mario Thomas" };
int goals[NR_PLAYERS];
int cards[NR_PLAYERS];
string namesMore;
inputInformation(goals, cards, names);
findPlayersWithMoreCardsThanGoals(goals, cards, names);
displayInfo(namesMore);
return 0;
}