Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

CCCCC+++

.rtf
Скачиваний:
22
Добавлен:
25.02.2016
Размер:
3.42 Кб
Скачать

Write a program that asks the user to type an integer and writes "YOU WIN" if the value is between 56 and 78 (both included). In the other case it writes "YOU LOSE". EXERCISE 2 Write a program that asks the user to type all the integers between 8 and 23 (both included) using a ANY loop. EXERCISE 3 Write a program that asks the user to type an integer N and computes the sum of the cubes from 5^3 to N^3. N is greater than 5. EXERCISE 4 Write a program that asks the user to type an integer N and compute u(N) defined with : u(0)=3 u(N+1)=3*u( N ) + 4 EXERCISE 5 The country A has 50M inhabitants, and its population grows 3% per year. The country B, 70M and grows 2% per year. Tell in how many years A will surpass B. EXERCISE 6 Write a C++ program which reads a string, less than 10 characters long. This string represents an integer expressed in roman numbers. Let a function convert the number from roman to arabic form (i.e., our standard digits). Let then the main program write out both forms. The roman numbers are written according to: M = 1000, D =500, C =100, L=50, X=10, V=5, I=1. Examples: LXXXVII = 87 CCXIX = 219 MCCCLIV = 1354 MMDCLXXIII = 2673 Note the difficulty when the numbers 4 and 9 are involved. This difficulty occurs also for higher numbers, e.g., MIC = 1099. Try to solve the problem for a case which is as general as possible. EXERCISE 7 (use pointers) You are given a string. Identify, wheather it is a palindrom or not. Palindrom is a word that can be read from left to right the same as from right to left. Input Input contains single string, without any spaces. Output Output YES if given string is palindrom or NO otherwise. Samples: No. Input Output 1 abba YES EXERCISE 8(use pointers) The correct sequence of bracket The correct sequence of the bracket is a string that consists entirely of characters, "bracketed" (only two types of brackers are availableten considered only parentheses, but this would be considered the general case of several types of braces), where each closing brace exists corresponding opening (with the same type). You have to make conclusion is this sequence has correct bracket sequence (YES) or not(NO) Input: {{}} Output: YES Input: {{} Output: NO EXERCISE 9 Write a C++ program which demonstrates options (adding, searching) of "Phone-book". Your program has to find needed information from phone-book (C:\phone.txt) and add if you want. Phone-book should store data: : . When you run your program display should show this menu: *** Phone-book *** 1. Add 2. Search 3. Quit Enter the number of option and press ->

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]