Get the latest Education e-news
 

Go Back   Game Career Guide Forums > Programming
Forum Home Register Members List Mark Forums Read

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 07-15-2009, 08: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
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Powered by vBulletin® Version 3.6.9
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
All times are GMT -8. The time now is 04:00 PM.






UBM Tech