DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2

Thread: Arrays

  1. #1
    ERIC Guest

    Arrays


    Can anyone tell me how to make an array that when the user enters
    some values for example they enter 143,450,650,342,395,247,685,800,1220,
    64,102,347,894. when these numbers are entered the array will put
    them in a range. for example for these numbers it would printout



    ranges AMOUNT IN EACH RANGE

    $0-99 ---------------- 1
    $100-199 ---------------- 2
    $200-299 ---------------- 1
    $300-399 ---------------- 3
    $400-499 ---------------- 1
    $500-599 ---------------- 0
    $600-699 ---------------- 2
    $700-799 ---------------- 0
    $800-899 ---------------- 2
    $900-999 ---------------- 0
    $1000+ ---------------- 1



    I just need to know how I would declare and allocate the array.
    Thank you.

  2. #2
    Paul Clapham Guest

    Re: Arrays

    You need 11 entries in your array, right? And you need them to be integers,
    because you're going to use them to count things, right? So:

    int counts[] = new int[11];

    PC2

    "ERIC" <wdiv@hotmail.com> wrote in message news:3b09a263$1@news.devx.com...
    >
    > Can anyone tell me how to make an array that when the user enters
    > some values for example they enter 143,450,650,342,395,247,685,800,1220,
    > 64,102,347,894. when these numbers are entered the array will put
    > them in a range. for example for these numbers it would printout
    >
    >
    >
    > ranges AMOUNT IN EACH RANGE
    >
    > $0-99 ---------------- 1
    > $100-199 ---------------- 2
    > $200-299 ---------------- 1
    > $300-399 ---------------- 3
    > $400-499 ---------------- 1
    > $500-599 ---------------- 0
    > $600-699 ---------------- 2
    > $700-799 ---------------- 0
    > $800-899 ---------------- 2
    > $900-999 ---------------- 0
    > $1000+ ---------------- 1
    >
    >
    >
    > I just need to know how I would declare and allocate the array.
    > Thank you.




Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links