Answered You can hire a professional tutor to get the answer.

QUESTION

I cant seem to get my player class working in my main class. Also how do I display variable from my player class in my main class?

I cant seem to get my player class working in my main class. Also how do I display variable from my player class in my main class?

// IT-312_Farkle_Final_DeHart_David.cpp : Defines the entry point for the console application.

#include "stdafx.h"

#include <iostream>

#include <string>

#include <fstream>

#include <vector>

#include <algorithm>

#include <ctime>

using namespace std;

class Player {

public:

vector<string>playerName;

int numPlayers;

int loopCount = 0;

string input;

string getPlayerName()

{

cout << "How many players are there? n";

cin >> numPlayers;

while (numPlayers > loopCount)

{

cout << "What are the players names? n";

cin >> input;

playerName.push_back(input);

loopCount++;

}

}

};

class gameRounds {

public:

int size;

int reRoll;

int rollingDie()

{

cout << "How many die will you role? n";

cin >> size;

for (int i = 0; i < size; i++)

{

vector<int>dieVector(size);

generate(dieVector.begin(), dieVector.end(), []() {return rand() % 6 + 1; });

cout << dieVector[i] << " ";

}

}

};

int main()

{

//gameRounds g;

string line_;

ifstream file_("rules.txt");

if (file_.is_open())

{

while (getline(file_, line_))

{

std::cout << line_ << "n";

}

file_.close();

}

Player.getPlayerName();  ////////////How do I properly call the function from my player class?

{

return();

}

return 0;

}

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question