السلام عليكم اخواني واخواتي





ارجو منكم المساعدة في حل هذه الاسئلة حيث ان جميعها يتطلب خبرة ودراسة امور لم ادرسها حتى الان ولكن دكتور المادة نظامه انه يعطينا هوم ووركات من برا المنهج ويقول دورو على النت .. ارجو انكم ماتخذلوني



Assignment #4
Given Date: 22 / 7 / 2009
Due Date: 29 / 7 / 2009
Loops + I/O Files
[LIST=1][*]
Write a C++ program that read an integer less than 10000 and prints the first n prime numbers on the screen. The output must be formatted in the following way: 10 prime numbers per line and there should be at most 8 positions to primt each number. Ask the user to press enter after printing each 23 lines on the screen.
[/LIST]

2. Write a program to read a number in a given base other than base 10 (decimal number system) and to convert this number into a decimal number. The program asks the user to choose the base first (any positive integer number greater than 1 and less than 10 for simplicity) and then the program asks the user to enter the number in that given base. The program should use loops to convert the last number into its equivalent in decimal number system.
Sample Runs:
Enter the base: 8 Enter the number in this base: 456 This number is equivalent to 302 in decimal.
Enter the base: 2 Enter the number in this base: 10011010010 This number is equivalent to 1234 in decimal.

3. Write a C++ program that reads data from an input file called “Input.txt” and counts how many times the file contained words that are the same as their inverse. Such words are called Palindromes. The input file can be downloaded from the BB. The program should print the number of palindromes found in the text on the screen, and also saves a copy of each palindrome found in the input file in another file (output file) called “palindromes.txt”.