Need Help with pointer arrays.

I have not been using pointers that long i most of my stuff has not needed them but now they do i need to learn how to use them more. I'm writing a program that simulates the squares most landed on(for fun) and i cant get a method to work because of an array pointer.

I've been working on this problem for 5 hours trying to fix it I've tried please help.

The error is no matching function for call to 'GameLoop::Loop(int, int (*)[4])'
Here is the latest version of the code. I've been editing a lot of things so there might be some stupid errors but I've tring everything.

rolling.h and rolling.cpp are just some dice function they are working perfect.

main.cpp
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
#include <iostream>
#include "Rolling.h"
#include "GameLoop.h"

Rolling Roll;
GameLoop Game;

int rolls[12];
int players = 4;
int playersPositions[4];
bool jail[4];

int main()
{

	Game.Loop(1000, &playersPositions);

	for(int i = 512*512*512; i > 0; i--){
		rolls[Roll.Roll(2, 6) - 1]++;
  }

  std::cout << "1: " << rolls[0] << std::endl;
  std::cout << "2: " << rolls[1] << std::endl;
  std::cout << "3: " << rolls[2] << std::endl;
  std::cout << "4: " << rolls[3] << std::endl;
  std::cout << "5: " << rolls[4] << std::endl;
  std::cout << "6: " << rolls[5] << std::endl;
  std::cout << "7: " << rolls[6] << std::endl;
  std::cout << "8: " << rolls[7] << std::endl;
  std::cout << "9: " << rolls[8] << std::endl;
  std::cout << "10: " << rolls[9] << std::endl;
  std::cout << "11: " << rolls[10] << std::endl;
  std::cout << "12: " << rolls[11] << std::endl;
  std::cout << "total: " << rolls[0] + rolls[1] + rolls[2] + rolls[3] + rolls[4] + rolls[5] + rolls[6] + rolls[7] + rolls[8] + rolls[9] + rolls[10] + rolls[11] << std::endl;

  return 0;
}


GameLoop.cpp
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
#include "GameLoop.h"
#include "Rolling.h"
#include <iostream>

GameLoop::GameLoop()
{
//GameLoop::GameLoop() : TileText{"GO", "MEDITER-RANEAN AVENUE", "COMMUNUTY CHEST", "BALTIC AVENUE", "INCOME TAX", "READING RAILROAD", "ORIENTAL AVENUE", "CHANCE", "VERMONT AVENUE", "CONNECTICUT", "JAIL", "ST. CHARLES PLACE", "ELECTRIC COMPANY", "STATES AVENUE",
//		"VIGINIA AVENUE", "PENNSYLVANIA RAILROAD", "ST. JAMES PLACE", "COMMUNUTY CHEST", "TENNESSEE AVENUE", "NEW YORK AVENUE", "FREE PARKING", "KENTUCKY AVENUE", "CHANCE", "INDIANA AVENUE", "ILLINOIS AVENUE", "B. & O. RAILROAD", "ATLANTIC AVENUE",
//		"VENTNOR AVENUE", "WATER WORKS", "MARVIN GARDENS", "GO TO JAIL", "PACIFIC AVENUE", "NORTH CAROLINA AVENUE", "COMMUNUTY CHEST", "PENNSYLVANIA AVENUE", "SHORT LINE", "CHANCE", "PARK PLACE", "LUXURY TAX", "BOARD WALK"};
}

void GameLoop::Loop(int Loops, int * PP){

	//&playersPositions = PP;
	while(Loops > 0){
			for(int p = 0; p < 4; p++){
				//*PP[p] += roll.Roll(2,6);
				//Tiles[*PP[p]]++;
			}
		Loops--;
	}
}

GameLoop::~GameLoop()
{
	//dtor
}


GameLoop.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#ifndef GAMELOOP_H
#define GAMELOOP_H

#include <iostream>
#include "Rolling.h"

class GameLoop
{
	public:
		Rolling roll;
		std::string TileText[40] = {"GO", "MEDITER-RANEAN AVENUE", "COMMUNUTY CHEST", "BALTIC AVENUE", "INCOME TAX", "READING RAILROAD", "ORIENTAL AVENUE", "CHANCE", "VERMONT AVENUE", "CONNECTICUT", "JAIL", "ST. CHARLES PLACE", "ELECTRIC COMPANY", "STATES AVENUE",
		"VIGINIA AVENUE", "PENNSYLVANIA RAILROAD", "ST. JAMES PLACE", "COMMUNUTY CHEST", "TENNESSEE AVENUE", "NEW YORK AVENUE", "FREE PARKING", "KENTUCKY AVENUE", "CHANCE", "INDIANA AVENUE", "ILLINOIS AVENUE", "B. & O. RAILROAD", "ATLANTIC AVENUE",
		"VENTNOR AVENUE", "WATER WORKS", "MARVIN GARDENS", "GO TO JAIL", "PACIFIC AVENUE", "NORTH CAROLINA AVENUE", "COMMUNUTY CHEST", "PENNSYLVANIA AVENUE", "SHORT LINE", "CHANCE", "PARK PLACE", "LUXURY TAX", "BOARD WALK"};
		int Tiles[40];
		int playersPositions[4];
		GameLoop();
		void Loop(int Loops, int * PP);
		virtual ~GameLoop();
	protected:
	private:
};

#endif // GAMELOOP_H 
shot in the dark Im new to this but in your prototyping did you trying gameloop(int, int) instead of just gameloop()
@CPlusPuke its a little weird but the gameloop is the constructor the function loop is what i need to work and im calling "game"."Loop" game as in the var for the class and loop as in the function everything should be setup fine but somewhere it is not. but it is for sure declared and being used.
Topic archived. No new replies allowed.