473,399 Members | 3,038 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Checking last index of the array giving me a problem. VS2005 C#

foolios
Expand|Select|Wrap|Line Numbers
  1.         private void CreateMaze(int h, int w)
  2.         {
  3.             int r = h * w;
  4.             Room[] rooms = new Room[r];
  5.             Random rm = new Random();
  6.             int newrm = rm.Next(0, r);
  7.             int nrmcntr = newrm;
  8.             do
  9.             {
  10.                 rooms[newrm].rWall = "|";
  11.                 if (newrm == rooms.Length() -1)
  12.                 {
  13.                     newrm = 0;
  14.                 }
  15.                 newrm += 1;
  16.             } 
  17.             while (newrm != nrmcntr);
  18.  
At the line:
if (newrm == rooms.Length() -1)
I am trying to compare an integer to the last index of an array of room objects.

I get the error:
Method name expected
at that line but have no clue.

Thank you in advance for any explanations.
Aug 6 '07 #1
1 1305
Reccy
10
if (newrm == rooms.Length() -1)
should be rooms.Length - 1

~~
Aug 6 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: David P. Jessup | last post by:
Good day folks. Within an ASP I'm working on I need to check whether an array is empty or not. Code: Dim somearray() 'other code: array might have been populated, maybe not if somearray()...
11
by: Vani Murarka | last post by:
Hi Everyone, Does .NET offer any collection class which will give me objects last *accessed* such that I may build a least-recently-used cache that kills off objects that haven't been used for...
29
by: Hagen | last post by:
Hello, in a recent thread "speed of vector vs array" I read about the problem of the slow acces by addressing vector elements by indexing, unfortunately I see no workaround in my case. My...
8
by: Jack Addington | last post by:
I want to scroll through the alphabet in order to scroll some data to the closest name that starts with a letter. If the user hits the H button then it should scroll to the letter closest to H. ...
8
by: Brendan | last post by:
There must be an easy way to do this: For classes that contain very simple data tables, I like to do something like this: class Things(Object): def __init__(self, x, y, z): #assert that x,...
5
by: JonH | last post by:
Ok, I have this dynamically created table in my one of my php forms that shows the names of the people the user has entered into a text field. When they hit add a row displays, showing the name...
19
by: Erich Pul | last post by:
hi! i got a structure, which should be filled with random integer values (it is in fact a generator for numbers like in a lotto), but these values must not be recurring, so no double occurrences...
2
by: gilad.kapel | last post by:
Hi I have a system composed of sevral DLLs all round up into one WebService. I'm working with VS2005 Framework 2.0 under WinXP. The system is at the end of its development stage and was both...
2
by: mindrage00 | last post by:
Hi! I am creating an image gallary where the images are numbered 1, 2, 3 etc. Users will be uploading the images so if i need to delete an image, I need the code to be able to check if that number...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.