Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
LCD Display
08-10-2009, 01:55 AM
Post: #1
LCD Display
A friend of yours has just bought a new computer. Before this, the most powerful machine he ever used was a pocket calculator. He is a little disappointed because he liked the LCD display of his calculator more than the screen on his new computer! To make him happy, write a program that prints numbers in LCD display style.
Input
The input file contains several lines, one for each number to be displayed. Each line contains integers s and n, where n is the number to be displayed (0 ≤ n ≤ 99, 999, 999) and s is the size in which it shall be displayed (1 ≤ s ≤ 10). The input will be terminated by a line containing two zeros, which should not be processed.
Output
Print the numbers specified in the input file in an LCD display-style using s “-” signs for the horizontal segments and s “|” signs for the vertical ones. Each digit occupies exactly s + 2 columns and 2s + 3 rows. Be sure to fill all the white space occupied by the digits with blanks, including the last digit. There must be exactly one column of blanks between two digits. Output a blank line after each number.
[Image: lcdassignment.JPG]

"I dont know with what weapons World War 3 will be fought with, but i know World War 4 will be fought with stones and sticks" - Albert Einstein
Visit this user's website Find all posts by this user
Quote this message in a reply
08-10-2009, 07:20 AM
Post: #2
RE: LCD Display
I am interested in this challenge i'll give it a try lol

"Character is determined more by the lack of certain experiences than by those one has had."
Friedrich Nietzsche
Visit this user's website Find all posts by this user
Quote this message in a reply
08-10-2009, 03:45 PM
Post: #3
RE: LCD Display
Yeah, it is interesting, i made it for one line, but it doesn't work propertly, so i am still working on it !

"I dont know with what weapons World War 3 will be fought with, but i know World War 4 will be fought with stones and sticks" - Albert Einstein
Visit this user's website Find all posts by this user
Quote this message in a reply
08-11-2009, 05:33 AM (This post was last modified: 08-11-2009 05:35 AM by l3g1sl4tor.)
Post: #4
RE: LCD Display
I done it using strings and working with files, but only for 1 size... Confused

(ne razumem postavku zadatka za velicinu brojeva) Confused
(i dont understand setup of task for size of numbers) Confused

BTW, i dont know to write this numbers in notepad corectly... they are pretty messy Tongue

Read rules Smile
[Image: legislator.png]
Find all posts by this user
Quote this message in a reply
08-11-2009, 06:15 PM
Post: #5
RE: LCD Display
When you have input, you have numbers of input in one line (look at the sample input) and first number is basically size !
Size represents number of dashes, one for one dash, two for two dashes and so on . . .
You have 5 main lines of representing this numbers, and 3 are horizontal and two are vertical !
And yeah, you need to do this with strings, that is good choice !
And if you made this for one dash, it is easy !
Make a function that generates string for horizontal (if size is 2 number of dashes is two or "_ _") !
And when you write horizontal, then you put for loop that counts from one to size and writes
in every line common string and then again horizontal . . .
I think you understand the purpose !

"I dont know with what weapons World War 3 will be fought with, but i know World War 4 will be fought with stones and sticks" - Albert Einstein
Visit this user's website Find all posts by this user
Quote this message in a reply
08-11-2009, 09:41 PM
Post: #6
RE: LCD Display
Yeah, we used same system, except i used not 1 dash in loop, but 2... so from that depends size of number... YAY! Big Grin Maybe I will more ready for next competition then I was for past Sad

Read rules Smile
[Image: legislator.png]
Find all posts by this user
Quote this message in a reply
08-12-2009, 04:36 PM
Post: #7
RE: LCD Display
(08-11-2009 09:41 PM)l3g1sl4tor Wrote:  Yeah, we used same system, except i used not 1 dash in loop, but 2... so from that depends size of number... YAY! Big Grin Maybe I will more ready for next competition then I was for past Sad
Yeah, always go ahead and practice, but you need to practice those dump assignments too like "Little girl went to the country side and wolf ate her . . ."
I hate those texts !

"I dont know with what weapons World War 3 will be fought with, but i know World War 4 will be fought with stones and sticks" - Albert Einstein
Visit this user's website Find all posts by this user
Quote this message in a reply
08-12-2009, 08:23 PM
Post: #8
RE: LCD Display
oh yes, they can totally mess your concentration and meaning on task... Sad

Read rules Smile
[Image: legislator.png]
Find all posts by this user
Quote this message in a reply
08-12-2009, 08:46 PM
Post: #9
RE: LCD Display
(08-12-2009 08:23 PM)l3g1sl4tor Wrote:  oh yes, they can totally mess your concentration and meaning on task... Sad
Yeah, i like those assignments that say "Do that !" and you do it !

"I dont know with what weapons World War 3 will be fought with, but i know World War 4 will be fought with stones and sticks" - Albert Einstein
Visit this user's website Find all posts by this user
Quote this message in a reply
08-16-2009, 01:14 PM
Post: #10
RE: LCD Display
If I have time, I'll try and solve this one using a bit of assembler and C. I think I may use BCD - Binary Coded Decimal - and see how it works...G4143
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


 Quick Theme: