473,395 Members | 2,192 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,395 software developers and data experts.

Confused with a program

Hi, I'm pretty new to JAVA and I haven't received the best help with creating programs. I am doing a program called Bunny.java and the basics about it is that you get a list of random numbers (ascending) located in a textfile. Then if an asterisk will be printed on top of the numbers if the difference between the current value and the value next is less than 50. This is a homework assignment, and my main question is this: What type of loop, array, ... will I need to make in order for the program to look at the textfile from the highest number all the way to the lowest?
Jan 12 '07 #1
1 1130
Ganon11
3,652 Expert 2GB
If the numbers are already sorted from lowest to highest in the file, I'm not sure of a way to read the highest to lowest, except indirectly:

Read all of the numbers into an array of integers, and then traverse that array from end to start. This should give you your desired result.
Jan 12 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Kevin C. | last post by:
Can someone explain why the file output produces all zeros? It seems to work fine in memory (e.g. passing char pointers to printf) but when I output the file, it comes out as zeros. Bookkeeping...
6
by: m_a_t_t | last post by:
Ok, I'm reading "The C Programming Language: 2nd Edition" and I'm on chapter 1.5.1 and here's the program you're sposed to make: #include <stdio.h> /* copy input to output; 1st version */...
9
by: Lalatendu Das | last post by:
I have seen a header file in which one structure is defined with extern declaration in a header file and declared one variable of that structure in one C-file. The code goes as mentioned below . I...
4
by: naveenpadmadas | last post by:
Hi, i have a simple query. I was practising a c program using function by just calling the function. The called function are defined with only printf statements. I tried executing the same program...
1
by: John Ruan | last post by:
This is a small program in C++. I want to try to type in real number instead of integer to see how the program runs. And I am confused. If I input integer for both variables, the program runs...
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
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.