using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace TacticalCheeseRacer
{
class Program
{
static int playerNum;
static int totalPlayers;
static Player[] players = new Player[4];
struct Player
{
public string Name;
public int Pos;
}
private static void PlayerTurn(int playerNo, int distance)
{
// TODO: Makes a move for the given player
}
static void ResetGame()
{
// TODO: get the number of players and set their positions at 0
}
static void GameTurn()
{
}
static void Main(string[] args)
{
Console.WriteLine("Enter total number of players for game:");
totalPlayers = int.Parse(Console.ReadLine());
for (int i = 0; i < totalPlayers; i++)
{
Player p;
Console.WriteLine("Enter player's details:");
Console.WriteLine("Name:");
p.Name = Console.ReadLine();
Console.WriteLine("Position:");
p.Pos = int.Parse(Console.ReadLine());
players[i] = p;
playerNum++;
} //while (playerNum < totalPlayers);
for (int i = 0; i < totalPlayers; i++)
{
Console.WriteLine(players[i]); // test to see if it works
}
}
}
// store player positions in arrays
}
Unhandled Exception: System.ArgumentNullException: Argument cannot be null.
Parameter name: s
at System.Int32.Parse (System.String s) [0x00000] in <filename unknown>:0
at TacticalCheeseRacer.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
Can't seem to find the error any1 have any ideas?