February 7th, 2009, 12:34 PM #1
- Join Date
- Feb 2009
So I'm new to this whole programming thing. My teacher is horriable and I have been looking in the book. However, I'm still lost. We have to make a program that reads in values and finds the smallest number. I know how to do everything except for the reading in of the values. (we are to assume the first read is number of ints that wil be entered)
can anyone help me?
February 8th, 2009, 05:31 PM #2
Yeah, I've had my share of bad teachers, but you just have to set your mind to not letting them win.
Write it in English (psuedo-code first).
Read first number....so, first_number = 10; we have 10 numbers to find the smallest.
Read next number....say it's 2635...store it in variable "smallest" (who knows, it could be!)
Read next number (which would be the second one in the list of ten) store it as "new_number" Say it's 10,030,884,388=
Is new_number less than smallest?
Yes...then let smallest equal new_number.
No...it's a bit bigger...go read the next number
Continue till you have read all 10 numbers.
After 10 numbers, "smallest" will hold the correct value
This is prime fodder for a for/next or while loop.
February 9th, 2009, 11:00 AM #3
- Join Date
- Jul 2008
- Boston, MA
- Blog Entries
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
By Yakri in forum Certification and EducationReplies: 11Last Post: October 9th, 2007, 08:17 PM
By lancelotstrife in forum General Tech DiscussionReplies: 7Last Post: November 20th, 2003, 10:39 AM
By nick.arnott in forum Webmastering and ProgrammingReplies: 3Last Post: July 5th, 2003, 01:19 PM
By PcGamer in forum General Tech DiscussionReplies: 6Last Post: October 22nd, 2002, 10:35 PM
By MDS in forum Webmastering and ProgrammingReplies: 51Last Post: October 4th, 2002, 08:18 PM