Слово
«operator»впервые сказано пользователем
Mana 14.05.2006 в 15:46,
и с тех пор употреблялось
40 раз.
Сообщения со словом
«operator»
Запрос выполнился за
0.0029 сек.
- 23.12.2007, 16:05. Ruben в теме
«Неделя 1. Полный перебор»
... sq i new char n 1 square const square sq1 sq null operator sq1 square operator const square sq1 if this sq1 return this delete sq sq new char n sq1 n for int i 0 i n i sq i new char n 1 for int i 0 i n i for int j 0 j n j sq i j sq1 sq i j return this square for int i 0 i n i delete sq i delete sq friend int operator const square sq1 const square sq2 if sq1 sq2...
- 14.05.2006, 15:46. Mana в теме
«HEEELP С++ 3.1 ShakerSort»
... key class data struct record key key data data int operator record b return key b key int operator record b return key b key int operator record b return key b key int operator record b return key b key void operator key n key n template class key class data void prnkey record class key class data t cout t key void main void clrscr long n i begin end record unsigned int mass 2 5 2 1 6 2 6 n sizeof mass sizeof mass 0 cout neotsortirovannij endl for i 0 i n i prnkey mass i shakersort mass n cout otsortir endl for i 0 i n i prnkey mass i getch файл type h структуры для хранения данных и ключей в массиве ifndef data защита от повторного включения этого файла define data в другой include iostream h ifdef number ключ число типа int long float и т д шаблоны позволяют использовать один и тот же код для различных типов данных и ключей template class key class data struct record key key data data перегрузка операций и для сравнения ключей структур int operator record b return key b key int operator record b return key b key int operator record b return key b key int operator record b return key b key перегрузка операции для ключа void operator key n key n печать ключа void prnkey cout key обмен template class key class data inline void swap record key data a record key data b record key data t t a a b b t обмен если 1-ый ключ 2-го template class key class data inline void ifmorethenswap record key data a record key data b if a b record key data t t a a b b t сравнение ключей template class key class data inline int compare record key data a record key data b return a b 1 a b 0 -1 elif defined str n ключ строка длиной len str include string h в программе перед include type h определять const len str число typedef char key len str 1 1 для хранения признака конца строки 0 template class data struct record key key data data перегрузка операций и для сравнения ключей структур int operator record b return fstrcmp key b key 0 int operator record b return fstrcmp key b key 0 int operator record b return fstrcmp key b key 0 int operator record b return fstrcmp key b key 0 void operator char s запись ключа в структуру типа record void prnkey char w key cout w template class data int compare record data a record data b return fstrcmp a key b key template class data void record data operator char s int j 0 for j len str s 0 j key j s key j 0 elif defined char ptr ключ строка си include string h т к с не допускает перегрузки операций для встроенных типов создадим обертку для char в виде структуры typedef struct key char key ptr template class data struct record key key ключ data data данные перегрузка операций и для сравнения ключей структур int operator record b return fstrcmp key key ptr b key key ptr 0 int operator record b return fstrcmp key key ptr b key key ptr 0 запись ключа в структуру типа record void operator char s key key ptr s void prnkey cout key...