• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

single arrays in java

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I can figured out what i do wrong.
I try to write simple program that inputs 20 numbers from user and display them in fange from 10 to 100, only if not duplicated.

(Marilyn added code tags to display formatted code)
[ March 22, 2003: Message edited by: Marilyn de Queiroz ]
[ edited to alleviate the pain of scrolling left and right -ds ]
[ March 23, 2003: Message edited by: Dirk Schreckmann ]
 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A few things to think about:
1. Why do you have i++ on two places in your for loop in your pick method?
2. What should happen to i when a duplicate is found, should it still be increased?
I think these things should correct your problem, if not, please state what the program does and what you think it should do instead. Good luck!
 
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What do you get when you compile the code?
Do you get an exception when you run the program?
You are also creating a lot of InputStreamReaders and BufferedReaders here. Maybe it's better to create only one pair and reuse them.
[ March 23, 2003: Message edited by: Barry Gaunt ]
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are also creating a lot of InputStreamReaders and BufferedReaders here. Maybe it's better to create only one pair and reuse them.
Go Cattle Drive!
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Whaddyamean? I'm bartending under the influence?
reply
    Bookmark Topic Watch Topic
  • New Topic