20100210

Second

Given this simple (working!) algorithm, please answer the next simple question:
What’s the number of rooms?
:)

if (RoomCount > 0)
{
    lblrooms.Text += dtGetRoomType.Rows[0]["Title"].ToString();
    for (int i = 0; i < RoomCount - 1; i++)
    {
        //int RoomCount = dtGetRoomType.Rows.Count;
        //lblrooms.Text += dtGetRoomType.Rows[i]["Title"].ToString();
        for (i = 0; i < RoomCount - 1; i++)
        {
            if (i > 0)
                lblrooms.Text += dtGetRoomType.Rows[i]["Title"].ToString();
            lblrooms.Text += " or ";
        }
        lblrooms.Text += dtGetRoomType.Rows[RoomCount - 1]["Title"].ToString();
    }
}

No comments:

Post a Comment