View Single Post
Old 07-16-2009, 09:54 AM   #3
Hazard117
Junior Member

Activity Longevity
0/20 14/20
Today Posts
0/11 sssssss13
Default

Wow, that was a stupid mistake...

After I updated the program, i get a problem when i insert the requirements.

Unhandled Exception: System.IndexOutOfRangeException: Idex was outside the bounds of the array. at work.Main()

Anyone have an idea??

Program-

using System;

public class Work

{

public static void Main()

{

int req, count1;
String strreq;
Console.Out.Write("The number of total requirements that a person needs is: ");
strreq = Console.ReadLine();
req = Convert.ToInt32(strreq);

string [] requirements = new string [req - 1];

count1 = 0;
while (count1 <= req)

{
Console.Out.Write("A requirement that is needed is: ");
requirements[count1] = Console.ReadLine();
count1 = count1 + 1;

}

Console.Out.WriteLine(requirements[req]);




}

}

Last edited by Hazard117 : 07-16-2009 at 10:02 AM.
Hazard117 is offline   Reply With Quote