feedback

(Solution document) 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

#include

#include

#include

#include

#include




using namespace std;




class Player {

public:

vectorplayerName;

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++)

{

vectordieVector(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;

}

 







About this question:

Pay using PayPal (No PayPal account Required) or your credit card. All your purchases are securely protected by .
SiteLock