473,387 Members | 1,441 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,387 software developers and data experts.

Writing out array values

Please help me with this

I have an array which has days of the month stored in it. For example at one
time it might have the values

1,2,3,6,7,8,9

at another time it might have the value

4,5,12,14,19,25

These are days of the month that have been selected and read into an array.
What i would like to do is to write them out and put a "X" where the days
were selected

Somthing like this

For i = 1 to 31
if i is found in the array
response.write "X"
else
response.write "-"
end if
Next
I cannot figure out how to search an array for the values

for example the output of the first example should be

1 2 3 4 5 6 7 8 9 10 11 12 ......
X X X - - X X X X - - -
Jul 19 '05 #1
1 1460
"JP SIngh" <no**@none.com> wrote in
news:Of**************@TK2MSFTNGP12.phx.gbl:
Please help me with this

I have an array which has days of the month stored in it. For example
at one time it might have the values

1,2,3,6,7,8,9

at another time it might have the value

4,5,12,14,19,25

These are days of the month that have been selected and read into an
array. What i would like to do is to write them out and put a "X"
where the days were selected

Somthing like this

For i = 1 to 31
if i is found in the array
response.write "X"
else
response.write "-"
end if
Next
I cannot figure out how to search an array for the values

for example the output of the first example should be

1 2 3 4 5 6 7 8 9 10 11 12 ......
X X X - - X X X X - - -


Are you set on doing this with two arrays?. If so you'll have to search
through the entire array 31 times, which is slow.

I would recommend using something else like a dictionary object or even
a single array.

Try creating an array with 31 values and initialize each value to false
with a quick loop. Then you can set individual values to true if they're
selected, like

ary(27) = true

for each selected day. This will make it easy to check if a day is
selected, all you need to do is

For i = 1 to 31
if ary(i) then
response.write "X"
else
response.write "-"
end if
Next

--
Catalyst
www.webforumz.com
Free Web Design and Development Help, Discussions, tips and Critique!
ASP, VB, .NET, SQL, CSS, HTML, Javascript, Flash, XML, SEO !
Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Paul C-T | last post by:
Hi, Am I trying to be too clever here? I am trying to write a PHP page to enable me to enter values into a form then write those values to a text file. I want to use the form & table that...
8
by: Howard | last post by:
My friend is seeking help with some homework writting javascript. Please respond to here address at ghina@hotmail.com Thanks for your help in advance. Write java statement to perform the...
10
by: Caryn Graves | last post by:
I need to write hex into a binary file, i.e., '00A8' (decimal 168) output as 2 bytes, 'FE' (decimal 254) output as 1 byte, etc. Suggestions??
5
by: Stimp | last post by:
I'm populating a dropdown list with non-consecutive values (well the last 3 values are non-consecutive anyway).. What's a shorter way of writing the following?... ddLetMaxPrice.Items.Insert(0,...
2
by: simonc | last post by:
Is there an easy way of writing a number in 32 bit integer format into four bytes of a file? I am experimenting with FilePut but I can only make it work by defining a four byte array and doing some...
0
by: bohuge | last post by:
Hey! At the time being I'm working on a backup solution for a Qtek9090 pocketpc, which should be able to find and backup outlook data to a server, local files, messages and contact from the sim...
3
by: Rich Shepard | last post by:
I need to learn how to process a byte stream from a form reader where each pair of bytes has meaning according to lookup dictionaries, then use the values to build an array of rows inserted into a...
6
by: arne.muller | last post by:
Hello, I've come across some problems reading strucutres from binary files. Basically I've some strutures typedef struct { int i; double x; int n; double *mz;
4
by: cagdasal | last post by:
Hello there, i am having the following problem, when i read an image the following way: public void readBitmapImage (String imagePath){ ImageDir = imagePath; //Read in the image file...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...

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.