Original Post
Hi all, i have been working on project1, but i cant get my code to verify if the user input is of the correct type, help will be appreciated.
using System;
using System.Collections.Generic;
using System.Text;
namespace maze
{
class Program
{
public class Settings
{
public void RowSettings()
{
int Rows;
string Temp;
int Temp2;
Console.WriteLine("Please enter the number of rows between 2-50:");
Temp = Console.ReadLine();
Console.WriteLine("You chose {0} rows", Temp);
Temp2 = int.Parse(Temp);
if (Temp2 >= 2 && Temp2 <= 50)
Rows = Temp2;
else
RowSettings();
}
}
static void Main(string[] args)
{
Console.WriteLine("Random Maze Generator by Yolda!");
Settings Settings = new Settings();
Settings.RowSettings();
}
}
}