Kselax.ru

Hacker Kselax — the best hacker in the world

Menu
  • Блог
  • Портфолио
  • Услуги
  • Контакты
  • wp plugin генератор
  • Русский
    • Русский
    • English
Menu

Реализация Cvt_to_upper.

Posted on 15 Сентябрь, 201322 Сентябрь, 2013 by admin

Реализуйте и протестируйте Cvt_to_upper (параграф D.4).

Ладно эту тему также на потом отложим, я просто набрал код тот что  в книге, ну конечно он ничего не работает.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include <iostream>
using std::cout;
using std::endl;
using std::cin;
#include <locale>
using std::locale;
using std::codecvt;
 
class Cvt_to_upper:public codecvt<char,char,mbstate_t>
{
explicit Cvt_to_upper(size_t r=0):codecvt(r){}
 
protected:
typedef state_type State;
//читаем внешнее представление пишем внутреннее:
result do_in(State& s,const char* from_end, const char*&
from_next, char* to, char* to_end, char*& to_next)const;
 
//читаем внутреннее представление пишем внешнее
result do_out(State& s,const char* from, const char* from_end, const char*&
from_next, char* to, char* to_end, char*& to_next)const
{
return codecvt<char,char,mbstate_t>::do_out
(s,from,from_end,from_next,to,to_end,to_next);
}
 
result do_unshift(State&, E* to, E* to_end, E* to_next)const {return ok;}
 
int do_encoding()const throw(){return 1;}
bool do_always_noconv()const throw(){return false;}
 
int do_length(const State&, const E* from, const E* from_end, size_t max)const;
int do_max_length()const throw();
};
 
codecvt<char,char,mbstate_t>::result
Cvt_to_upper::result do_in(State& s,const char* from_end, const char*&
from_next, char* to, char* to_end, char*& to_next)const;
{
//тут ее нужно самому реализовать
}
 
int main()
{
locale ulocale(locale(),new Cvt_to_upper);
cin.imbue(ulocale);
char ch;
while(cin >>ch)cout <<ch;
cout <<endl;
 
return 0;
}

[youtube]https://www.youtube.com/watch?v=Ggd8_B39zeM[/youtube]

Добавить комментарий Отменить ответ

Ваш e-mail не будет опубликован. Обязательные поля помечены *

Рубрики

  • C++ (293)
  • MFC (39)
  • vBulletin (5)
  • Visual Studio (9)
  • wordpress (18)
  • Разное (28)

Метки

Ajax bootstrap CLI FormData GDlib google Invisible reCAPTCHA media MFC php repository wordpress RTTI STL vBulletin vector Visual Studio WINAPI wordpress wp-plugins XMLHttpRequest Двоичное дерево Задачи С++ Игры С++ Исключения С++ О-большое Операторы_С++ Перегрузка операторов С++ Поиск С++ Потоки Проектирование_С++ С++ Типы_С++ Типы С++ Шаблоны С++ библиотеки локализация макросы С++ сортировка С++

Свежие комментарии

  • HollyFrunk к записи Программка для заполнения форума на vBulletin 3.8.7
  • rwerwer к записи google Invisible reCAPTCHA Установка
  • ertert к записи google Invisible reCAPTCHA Установка
  • FrolovAlexbit к записи Программка для заполнения форума на vBulletin 3.8.7
  • Egor к записи C++ прочитать все имена файлов из директории.
©2019 Kselax.ru Theme by ThemeGiant