الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

Need a help

بدأه ENG.MB في 13 أبريل 2011 · 2 رد · 502 مشاهدة · في الأسئلة المجابة
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

Exercise 1

To make telephone numbers easier to remember, some users (such as companies or

individuals) use letters to show their telephone number. For example, using letters, the

telephone number 438 5466 can be shown as GET LOAN. In some cases, to make a telephone

number meaningful, users may use more than 7 letters. For example, 255 5466 can be

displayed as CALL HOME, which uses 8 letters. Write a program that prompts the user to

enter a telephone number expressed in letters ending with a period (‘.’) and outputs the

corresponding number in digits. If the user enters more than 7 letters then process only the

first 7 letters. Also output a space after the third digit. Allow the user to input in uppercase

and lower case letters as well as spaces between words. Moreover, your program should

process as many telephone numbers as the user wants. The following are some examples.

252414991.jpg

Exercise 2

The C++ programming course has 250 students. As each students needs his/her

heavy textbook in class and lab, lockers are to be assigned to students; one

locker for each student. Before assigning the lockers, the course instructors sort

all students names in one list and play the following game: they ask the first

student on the list to go and open all lockers. They then ask the 2nd student to go

and close all the even‐numbered lockers. The 3rd student is asked to check every

3rd locker. If it is open, the student closes it; if it is closed, the student opens it.

The 4th student is asked to check every 4th locker. If it is open, the student closes

it; if it is closed, the student opens it. The remaining students continue this

game. In general the nth student checks every nth locker. If th elocker is open, the

student closes it; if it is closed, the student opens it. After all the students have

taken their turns, some of the lockers are open and some are closed. Write a

program that prompts the user to enter the number of lockers. After the game is

over, the program outputs the number of lockers that are opened. Test run your

program for the following inputs: 1000, 5000, and 10000.

Hint: Consider locker number 100. This locker is visited by student numbbers 1, 2,

4, 5, 10, 20, 25, 50 and 100. These are th epositive divisors of 100. Similarly,

locker 30 is visited by student numbers 1, 2, 3, 5, 6, 10, and 30. Notic ethat if th

enumber of positive divisors of a locker number is odd then at th eend of the

game this locker is opened. If the number of positive divisors of a locker number

is even, then at th eend of the game, the locker is closed.

بلييييز هذا HW أو لازم اسسلمه باجر وأتمنى تساعدووووني :(

تم تعديل هذه المشاركة بواسطة ENG.MB في 13 أبريل 2011 في 00:44

−3
#2

أتمنى الرد ضرووووووووووووووريي بلييز :(

−1
#3

ماهو المطلوب وضحي اكثر

get-4-2011-almlf_com_6vjvohds.jpg

مواضيع مشابهة