Re: array of booleans



zeus2@xxxxxxxxxxx wrote in news:1128145921.794117.187320
@g49g2000cwa.googlegroups.com:

> perahps this sample output might help. I have an array for the votes,
> however, when no NUMERIC vote is entered, i want to be able to default
> the lowest number, 1,2 in this case for the votes that have not been
> physically entered. Don't i need to store it in an array? Some
> pseudocode would be helpful in breaking the problem down..
>
> cheers...peri
>
> Please enter the next vote
> Ballot paper 1
> Please enter the next vote (for Brad): 3
> Please enter the next vote (for Candidate 2): <---no vote(defaults 1)
> Please enter the next vote (for Julian): <---no vote(defaults 2)
> Please enter the next vote (for Rob): 4
> Please enter the next vote (for Ian): 5
> (E)nter or (R)eset ballot paper: e
> Vote 1 entered; Please enter the next vote
> Do you have more ballot papers to enter (Y/N): n
>
>


I don't think you need an array of booleans here. You just keep track of
what the current lowest number is, and if nothing was entered, you use
this lowest number.


in pseudo code:

initialize lowestInt to 1
read the input
if input is not an integer
{
value = lowestInt
lowestInt++
}
else
value = input
use value


Note that this does not account for the user entering 1 on the first
line, then nothing on the second. In this case you'll have 1 for both
votes.
.



Relevant Pages

  • Re: Index ( )
    ... My vote is the former. ... Array vs. Reference ... INDEXis categorized into array form and reference form. ...
    (microsoft.public.excel.newusers)
  • RE: Using VLOOKUP to locate an answer in one of multiple columns
    ... Please rate this post using the vote buttons if it was helpful. ... "ksean" wrote: ... Do you have any ideas what I am missing? ... When you do a look up, you are looking up a value in an array, so if the ...
    (microsoft.public.excel.worksheet.functions)
  • RE: Using VLOOKUP to locate an answer in one of multiple columns
    ... Please rate this post using the vote buttons if it was helpful. ... "ksean" wrote: ... Do you have any ideas what I am missing? ... When you do a look up, you are looking up a value in an array, so if the ...
    (microsoft.public.excel.worksheet.functions)
  • Re: Moderated group voting procedure
    ... Someone please tell me how to join/ vote? ... Votetaker: Pedt Scragg ... Initial Moderation Policy ... Instructions on how to obtain a ballot paper and template ...
    (uk.rec.cycling)
  • Repost of 1st CFV - Create moderated newsgroup uk.rec.cycling.moderated
    ... Votetaker: Pedt Scragg ... Initial Moderation Policy ... Instructions on how to obtain a ballot paper and template ... This means your vote will not be counted. ...
    (uk.rec.cycling)