View Single Post
Old 07-15-2009, 09:36 PM   #1
Hazard117
Junior Member

Activity Longevity
0/20 14/20
Today Posts
0/11 sssssss13
Question Help with a small program please

Hello, I'm a High School Student whom is aiming for a job as a Game Programmer (still haven't gotten specific yet).

This is part (what i got so far) of a program that I'm writing for a friend. In this program the aim is to ask how many requirements there are. Then i made an array with the variable that held the amount of requirements needed. Then using a loop, i started to assign the elements with the requirements that are going to be inputted by the user.

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 = 1;
while (count1 <= req)
;
{
Console.Out.Write("A requirement that is needed is: ");
requirements[count1] = Console.ReadLine();
count1 = count1 + 1;

}

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


}

}

A message comes up when compiled- Work.cs(21,2): warning CS0642: Possable mistaken empty statement

It seems I'm using it (the variable "count1") to make it so the user can add a value to the Array's elements. When ran it ends up being an infinite loop.


The last code "Console.Out.WriteLine(requirements[req]);" was just for me to see if it'd work (obviously didn't since i can't even get that far) but is not "part" of the program I'll be running once i figure this out.



If anyone can help that would be great. I'd appreciate a reply of why you think its not working.

Have a good one
Hazard117 is offline   Reply With Quote