المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : اللي يعرف لسي ++ الرجاء المساعدة



habahaba
08-11-2003, 07:08 AM
السلام عليكم ورحمة الله وبركاته
كل عام وانتم بخير
ياشباب ا نا طالبكم في خدمة
انا عندي برنامج لازم اسويه
البرنامج هو انو المستخدم لازم يكتب شعر
طول الشعر لازم يكون اربع اسطر
المطلوب من البرنامج انو يقول اذا كان فيه اخطاء
الأخطاء هيه :
1- انه اول حرف من كل سطر لازم يكون كابيتال
2- انه الشعر يكون بصيغة وحده مثلا:
ذهبت الى بيتي
وضربت مدرسي
يعني اخر حرف من اخر كلمة من السطر الأول لازم تكون نفسها في السطر الثاني وهكذا
بس انا مابغى البرنامج يصلحها
انا ابغى البرنامج يقول اذا كان صح ولا غلط valid or invalid

والله مني عارف اسويه ولا تبخلو عليه
وعلى فكرة ممنوع استخدام ال string or arrays
والله اني مابتشرط بس مطلوب هو كدا ولازم يكون بلغة السي بلس بلس
وهذة النسخة بلغة الإنجليزية
وشكرا


This is an exercise in character manipulation. This means you are to work with single characters and not arrays of characters (and not Strings). Read this assignment carefully!



Problem Statement:



You have been writing some poetry for the first time – and are interested in having a program check to see if your phrases rhyme and if it is capitalized correctly; the rules for rhyming that we will follow are described in this assignment.



Input from the User:



Allow the user to enter in a poem (prompt them first!). . Each line ends when a newline is encountered. There should be punctuation. Have each poem be 4 lines long.



Output to the User:

Our resulting output will be: Valid/Invalid Capitalization and Valid/InValid Rhyming. You are not expected to echo the poem.



Rules:

Valid situations are the following:

a) The first letter of each line must be capitalized

The first letter after a period, ?, ! must also be capitalized

c) The last word on the 2nd line must rhyme with the last word on the 1st line. The last word on the 4th line must rhyme with the last word on the 2nd line.

d) For us, let’s assume rhyming means that the last 3 characters of a word are the same – disregarding punctuation. So, “rain” and “Spain” rhyme.

e) If the last word is shorter than 3 characters – then the entire word’s characters are use. So, if the last word was “to” it would rhyme with “goto”



REMEMBER, YOU MUST DO THIS WORKING AT THE INDIVIDUAL CHARACTER LEVEL – THIS MEANS YOU WILL NEED A NUMBER OF CHARACTER VARIABLES IN YOUR PROGRAM TO SOLVE THIS.



ALSO, SPEND TIME ON THE ALGORITHM PRIOR TO WRITING THE PROGRAM. UNLIKE PROGRAMS 2 AND 3 THIS ASSIGNMENT IS LOGICALLY MORE COMPLEX.



EVEN IF YOU KNOW ABOUT ARRAYS OF CHARACTERS OR STRINGS – YOU MAY NOT USE THEM IN THIS ASSIGNMENT.



Now, what is important for your program:

1) Prompt for the user to enter a poem.

2) Do not attempt to echo it back out. You will be unhappy with the results.

3) Read the poem one character at a time. Do not use arrays yet!

4) After displaying the results, allow the user to enter another line of text, and

display those result. Continue this process until the user is ready to be done

Thunderbird
08-11-2003, 09:35 AM
أذهب الي منتدى البرمجة.
هنا خاص بالبرامج فقط