[ back to toc ]

About C program....^^

Date: 2002/03/16 12:40

Q:
hello...
my name is billy...
i am uni student and i have a project which i have to write a program in C
language...
but i have no idea what is C language is like ...
so would you please help me with this assignment...
the question is;

Programming Task
Write a program in the C programming language that takes text either from
stdin or as a command parameter and translates the text to Morse Code.

Write a function that translates each character to its corresponding
international morse code representation. The function should take a single
character as a parameter and return a string containing the corresponding
morse code. Your program should use this function for the actual
conversion to Morse Code!

The international morse code is defined as follows:

Char Code Char Code Char Code
A .- N -. 0 B -... O --- 1 .C -.-. P .--. 2 ..D -.. Q --.- 3 ...E . R .-. 4 ....F ..-. S ... 5 .....
G --. T - 6 -....
H .... U ..- 7 --...
I .. V ...- 8 ---..
J .--- W .-- 9 ----.
K -.- X -..- Fullstop . .-.-.L .-.. Y -.-- Comma , --..M -- Z --.. Query ? ..--..

The output of your program must be such, that:

upper and lower case characters are treated the same,
An exclamation mark "!" is treated like a fullstop ".",
there is exactly one space between morse codes representing two
consecutive non-blank (i.e., non-white-space) characters,
there are exactly three spaces between words separated by one or more
white-space characters; and
the output is terminated by a newline "\n" character.
For example:

Input Output
Hi
.... ..

Hello, world!
.... . .-.. .-.. --- --..-- .-- --- .-. .-.. -.. .-.-.
Pardon?
.--. .- .-. -.. --- -. ..--..

Don't forget to use comments to describe the functionality of your
program! In particular, each module must have a header describing who
wrote the module (including name and student number!), when the module was
written, what the module does, and how it does that. The description of
what the module does and how it performs that function should be
descriptive enough for someone who does not read the rest of the source
code to understand the functionionality of the module.

Each function must be accompanied by a similar header describing what the
function does, what parameters it takes, and what it returns.

if you can help me with this then i will be more then happy...
i just want to learn C but i did not know here to start...so....
can you give me this question's answer right away....please...^^

thank-you...
A:
All I can say is: nice try!

I will not make a homework instead of you, because I take this volunteer
job to help you, especially help you delivering knowledge and not to help
you to get through the degrees without knowledge!

Buy some good book about the language C, there are numerous, and invest a
few weeks to learn it and practice it! You will not get that easier! By
the time I learnt C in 1983 there was only a single book on it, the K&R
classical. Today you are in a much better position having enormous amount
of tutorials.

Regards,
Peter

[ back to toc ]