Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Liar's Dice code is throwing 2 errors. Severity Code Description Project File Line Suppression State Error LNK1120 1 unresolved externals 1 Error LNK2019 unresolved

C++ Liar's Dice code is throwing 2 errors.

Severity Code Description Project File Line Suppression State Error LNK1120 1 unresolved externals 1 Error LNK2019 unresolved external symbol _main referenced in function "int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ) C:\######\MSVCRTD.lib(exe_main.obj) 1

CODE

#include "stdafx.h" #include #include #include #include

using namespace std;

const int DICE = 4;

class Player //Player Class {

private: string name; int diceLeft; int hand[DICE];

public: //constructor Player(string theName); int diceCount[6];

//methods void roll(); void show(); void count(); };

//Player constructor definition Player::Player(string theName) { name = theName; diceLeft = DICE; } //Player method definitions

void Player::roll() { for (int i = 0; i < diceLeft; ++i) { hand[i] = 1 + rand() % 6; } }

void Player::show() { for (int i = 0; i < diceLeft; ++i) { cout << hand[i] << endl; } }

void Player::count() { for (int i = 0; i < 6; ++i) { diceCount[i] = 0; }

for (int n = 0; n < diceLeft; ++n) { diceCount[hand[n] - 1]++; } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions