error C3861 - Issue Building Code

I know this is probably a simple error that I am doing wrong but I can't get my code to build. Please any suggestions will be helpful.
Thanks
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90

#include <list>
#include <string>
#include <sstream>
#include <iostream>
#include <algorithm>
#include "Random.h"
using namespace std;

int main()
{

	int adelta = 0;
	int ddelta= 0;
	bool isLegal;


	getAttackResults(2,2,adelta,ddelta,isLegal);


	system("pause");
	return 0;
}





void getAttackResults(int attackingArmies, int defendingArmies, int& attackingDelta, int& defendingDelta, bool& isLegal)
{
	CRandom Dice;
	list<int> Attack;
	list<int> Defend;


	for (int i = 0; i <attackingArmies-1; i++)
	{
		Attack.push_back(Dice.getValue(1,6));
	}
	if (attackingArmies = 2)
	{
		Attack.push_back(0);
	}
	if (attackingArmies = 1)
	{
		Attack.push_back(0);
		Attack.push_back(0);
	}
	for (int j = 0; j < defendingArmies-1; j++)
	{
		Defend.push_back(Dice.getValue(1,6));
	}
	if (defendingArmies = 1)
	{
		Defend.push_back(0);
		Defend.push_back(0);
	}
	if (defendingArmies = 2)
	{
		Defend.push_back(0);
	}


	Attack.sort();
	Defend.sort();

	Attack.reverse();
	Defend.reverse();

	for (int i = 0; i < 3; i++)
	{
		while (Attack.front() != 0 || Defend.front() != 0)
		{
			if(Attack.front() > Defend.front())
			{
				defendingDelta++;
				Attack.pop_front();
				Defend.pop_front();
			}
			else if (Defend.front() >= Attack.front())
			{
				attackingDelta++;
				Attack.pop_front();
				Defend.pop_front();
			}
		}
	}


};
Last edited on
Declare a prototype of your getAttackResults before you call it.
Topic archived. No new replies allowed.