Gökhan ÖZİÇ
unread,May 25, 2008, 7:25:10 AM5/25/08Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Çankaya Bilgisayar Mühendisliği
Arkadaşlar merhaba;
Hepinizin heyecanla beklediği an geldi :D. Murat hocayla konuştum ve
ilk dönem olduğu gibi örnek sorular elime ulaştı. Yalnız ufak bir
problem var. Murat hoca Deitel kitabında "file processing"
ünitesindeki soruların yetersiz olduğunu söyledi ve bu ünite hakkında
örnek soru vermedi. Hatta sırf bu yüzden lab sorularını kendisi
yazmış. String konusunda örnek sorular verdi ve bizim, text file
konusunda alıştırma yaparken vereceğim sorularınn outputlarını bir
text dosyasına yazan ya da kullanıcının gireceği inputları text
dosyasından okuyan programlar yazmamızı önerdi. Ayrıca labda
yazdığımız programlara da çalışmamızı önerdi. Murat hoca herkese
başarılar diledi. Bende herkese başarılar diliyorum. İşte beklenen
sorular:
8.13. Write a program that encodes English language phrases into pig
Latin. Pig Latin is a form of coded language often used for
amusement. Many variations exist in the methods used to form pig Latin
phrases. For simplicity, use the following algorithm:
To form a pig Latin phrase from an English language phrase, tokenize
the phrase into words with function strtok. To translate
each English word into a pig Latin word, place the first letter of the
English word at the end of the English word, and add the
letters "ay." Thus the word "jump" becomes "umpjay," the word "the"
becomes "hetay" and the word "computer" becomes
"omputercay." Blanks between words remain as blanks. Assume the
following: The English phrase consists of words separated
by blanks, there are no punctuation marks, and all words have two or
more letters. Function printLatinWord should display each
word. [Hint: Each time a token is found in a call to strtok, pass the
token pointer to function printLatinWord, and print the pig
Latin word.]
Sample run:
Enter a sentence:
characters and strings
The sentence in Pig Latin is:
haracterscay ndaay tringssay.
8.23 Write a program that reads a series of strings and prints only
those strings beginning with the letter "b."
Sample run:
Enter a string: the
Enter a string: big
Enter a string: bad
Enter a string: boy
Enter a string: sings
The strings starting with 'b' are:
big
bad
boy
8.24 Write a program that reads a series of strings and prints only
those strings that end with the letters "ed."
Sample run:
Enter a string: WALKED
Enter a string: SKIPPED
Enter a string: JUMPED
Enter a string: FLEW
Enter a string: DROVE
The strings ending with "ED" are:
WALKED
SKIPPED
JUMPED
8.34.c Write a program that reads several lines of text and prints a
table indicating the number of occurrences of each different
word in the text. The first version of your program should include the
words in the table in the same order in which they
appear in the text. A more interesting (and useful) printout should
then be attempted in which the words are sorted alphabetically.
For example, the lines
To be, or not to be: that is the question:
Whether 'tis nobler in the mind to suffer
contain the words "to" three times, the word "be" two times, the word
"or" once, etc.
Sample run:
Enter three lines of text:
This program counts the number
of occurrences of each word in
the input text.
"This" appeared 1 time
"program" appeared 1 time
"counts" appeared 1 time
"the" appeared 2 times
"number" appeared 1 time
"of" appeared 2 times
"occurrences" appeared 1 time
"each" appeared 1 time
"word" appeared 1 time
"in" appeared 1 time
"input" appeared 1 time
"text" appeared 1 time
8.36 (Printing Dates in Various Formats) Dates are commonly printed in
several different formats in business correspondence.
Two of the more common formats are
07/21/2003 and July 21, 2003
Write a program that reads a date in the first format and prints that
date in the second format.
Sample run:
Enter a date in the form mm/dd/yyyy: 06/18/2003
The date is: June 18, 2003
8.40 (A Metric Conversion Program) Write a program that will assist
the user with metric conversions. Your program should
allow the user to specify the names of the units as strings (i.e.,
centimeters, liters, grams, etc., for the metric system and inches,
quarts, pounds, etc., for the English system) and should respond to
simple questions such as
"How many inches are in 2 meters?"
"How many liters are in 10 quarts?"
Your program should recognize invalid conversions. For example, the
question
"How many feet in 5 kilograms?"
is not meaningful, because "feet" are units of length while
"kilograms" are units of mass.
Herkese kolay gelsin arkadaşlar.