Warning: file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 88

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 215

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 216

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 217

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 218

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 219

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 220
PK!~kooutil.hnu[/********************************************************************** * © 2016 and later: Unicode, Inc. and others. * License & terms of use: http://www.unicode.org/copyright.html#License *********************************************************************** *********************************************************************** * COPYRIGHT: * Copyright (c) 1999-2002, International Business Machines Corporation and * others. All Rights Reserved. ***********************************************************************/ #include "unicode/unistr.h" using namespace icu; // Verify that a UErrorCode is successful; exit(1) if not void check(UErrorCode& status, const char* msg); // Replace nonprintable characters with unicode escapes UnicodeString escape(const UnicodeString &source); // Print the given string to stdout void uprintf(const UnicodeString &str); PK!?MVqqMakefilenu[# Copyright (C) 2016 and later: Unicode, Inc. and others. # License & terms of use: http://www.unicode.org/copyright.html#License # # Copyright (c) 2000-2002 IBM, Inc. and others # sample code makefile # Usage: # - configure, build, install ICU (make install) # - make sure "icu-config" (in the ICU installed bin directory) is on # the path # - do 'make' in this directory #### definitions # Name of your target TARGET=msgfmt # All object files (C or C++) OBJECTS=main.o util.o #### rules # Load in standard makefile definitions include ../defs.mk # the actual rules (this is a simple sample) include ../rules.mk PK!##answers/main_3.cppnu[/********************************************************************** * © 2016 and later: Unicode, Inc. and others. * License & terms of use: http://www.unicode.org/copyright.html#License *********************************************************************** *********************************************************************** * COPYRIGHT: * Copyright (c) 1999-2002, International Business Machines Corporation and * others. All Rights Reserved. ***********************************************************************/ #include "unicode/unistr.h" #include "unicode/msgfmt.h" #include "unicode/calendar.h" #include #include #include "util.h" // The message format pattern. It takes a single argument, an integer, // and formats it as "no", "one", or a number, using a NumberFormat. static UnicodeString PATTERN( "Received {0,choice,0#no arguments|1#one argument|2#{0,number,integer} arguments}" " on {1,date,long}." ); int main(int argc, char **argv) { UErrorCode status = U_ZERO_ERROR; UnicodeString str; FieldPosition pos; // Create a message format MessageFormat msg(PATTERN, status); check(status, "MessageFormat::ct"); // Create the argument list Formattable msgArgs[2]; msgArgs[0].setLong(argc-1); msgArgs[1].setDate(Calendar::getNow()); // Format the arguments msg.format(msgArgs, 2, str, pos, status); check(status, "MessageFormat::format"); printf("Message: "); uprintf(str); printf("\n"); printf("Exiting successfully\n"); return 0; } PK!hanswers/main_2.cppnu[/********************************************************************** * © 2016 and later: Unicode, Inc. and others. * License & terms of use: http://www.unicode.org/copyright.html#License *********************************************************************** *********************************************************************** * COPYRIGHT: * Copyright (c) 1999-2002, International Business Machines Corporation and * others. All Rights Reserved. ***********************************************************************/ #include "unicode/unistr.h" #include "unicode/msgfmt.h" #include "unicode/calendar.h" #include #include #include "util.h" // The message format pattern. It takes a single argument, an integer, // and formats it as "no", "one", or a number, using a NumberFormat. static UnicodeString PATTERN( "Received {0,choice,0#no|1#one|1& {0,number,integer}} arguments" " on {1,date,long}." ); int main(int argc, char **argv) { UErrorCode status = U_ZERO_ERROR; UnicodeString str; FieldPosition pos; // Create a message format MessageFormat msg(PATTERN, status); check(status, "MessageFormat::ct"); // Create the argument list Formattable msgArgs[2]; msgArgs[0].setLong(argc-1); msgArgs[1].setDate(Calendar::getNow()); // Format the arguments msg.format(msgArgs, 2, str, pos, status); check(status, "MessageFormat::format"); printf("Message: "); uprintf(str); printf("\n"); printf("Exiting successfully\n"); return 0; } PK!`__answers/main_1.cppnu[/********************************************************************** * © 2016 and later: Unicode, Inc. and others. * License & terms of use: http://www.unicode.org/copyright.html#License *********************************************************************** *********************************************************************** * COPYRIGHT: * Copyright (c) 1999-2002, International Business Machines Corporation and * others. All Rights Reserved. ***********************************************************************/ #include "unicode/unistr.h" #include "unicode/msgfmt.h" #include #include #include "util.h" int main(int argc, char **argv) { UErrorCode status = U_ZERO_ERROR; UnicodeString str; printf("Message: "); uprintf(str); printf("\n"); printf("Exiting successfully\n"); return 0; } PK!answers/main_0.cppnu[/********************************************************************** * © 2016 and later: Unicode, Inc. and others. * License & terms of use: http://www.unicode.org/copyright.html#License *********************************************************************** *********************************************************************** * COPYRIGHT: * Copyright (c) 1999-2003, International Business Machines Corporation and * others. All Rights Reserved. ***********************************************************************/ #include "unicode/unistr.h" #include "unicode/msgfmt.h" #include "unicode/uclean.h" #include #include #include "util.h" int main(int argc, char **argv) { UErrorCode status = U_ZERO_ERROR; UnicodeString str; printf("Message: "); uprintf(str); printf("\n"); u_cleanup(); printf("Exiting successfully\n"); return 0; } PK!XP&&msgfmt.vcxprojnu[ {5FF1D1A2-1630-446C-B6EA-93EFD4F975C3} Application false MultiByte <_ProjectFileVersion>10.0.30319.1 .\x86\Release\ .\x86\Release\ false .\x64\Release\ .\x64\Release\ false .\x86\Debug\ .\x86\Debug\ true .\x64\Debug\ .\x64\Debug\ true .\x86\Release/msgfmt.tlb OnlyExplicitInline ..\..\..\include;%(AdditionalIncludeDirectories) MultiThreadedDLL true .\x86\Release/msgfmt.pch .\x86\Release/ .\x86\Release/ .\x86\Release/ Level3 true Default icuuc.lib;icuin.lib;%(AdditionalDependencies) .\x86\Release/msgfmt.exe ..\..\..\lib;%(AdditionalLibraryDirectories) .\x86\Release/msgfmt.pdb Console .\x64\Release/msgfmt.tlb OnlyExplicitInline ..\..\..\include;%(AdditionalIncludeDirectories) MultiThreadedDLL true .\x64\Release/msgfmt.pch .\x64\Release/ .\x64\Release/ .\x64\Release/ Level3 Default icuuc.lib;icuin.lib;%(AdditionalDependencies) .\x64\Release/msgfmt.exe ..\..\..\lib64;%(AdditionalLibraryDirectories) .\x64\Release/msgfmt.pdb Console .\x86\Debug/msgfmt.tlb ..\..\..\include;%(AdditionalIncludeDirectories) MultiThreadedDebugDLL .\x86\Debug/msgfmt.pch .\x86\Debug/ .\x86\Debug/ .\x86\Debug/ Level3 true EditAndContinue Default icuucd.lib;icuind.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) .\x86\Debug/msgfmt.exe ..\..\..\lib;%(AdditionalLibraryDirectories) true .\x86\Debug/msgfmt.pdb Console .\x64\Debug/msgfmt.tlb ..\..\..\include;%(AdditionalIncludeDirectories) MultiThreadedDebugDLL .\x64\Debug/msgfmt.pch .\x64\Debug/ .\x64\Debug/ .\x64\Debug/ Level3 ProgramDatabase Default icuucd.lib;icuind.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) .\x64\Debug/msgfmt.exe true ..\..\..\lib64;%(AdditionalLibraryDirectories) true .\x64\Debug/msgfmt.pdb Console PK! argument(s) on .", where n is the number of command line arguments (use argc-1), and d is the date (use Calendar::getNow()). HINT: Your message pattern should have a "number" element and a "date" element, and you will need to use Formattable. Problem 2: ChoiceFormat (Medium) We can do better than "argument(s)". Instead, we can display more idiomatic strings, such as "no arguments", "one argument", "two arguments", and for higher values, we can use a number format. This kind of value-based switching is done using a ChoiceFormat. However, you seldom needs to create a ChoiceFormat by itself. Instead, most of the time you will supply the ChoiceFormat pattern within a MessageFormat pattern. Use a ChoiceFormat pattern within the MessageFormat pattern, instead of the "number" element, to display more idiomatic strings. EXTRA: Embed a number element within the choice element to handle values greater than two. ANSWERS ------- The exercise includes answers. These are in the "answers" directory, and are numbered 1, 2, etc. If you get stuck and you want to move to the next step, copy the answers file into the main directory in order to proceed. E.g., "main_1.cpp" contains the original "main.cpp" file. "main_2.cpp" contains the "main.cpp" file after problem 1. Etc. Have fun! PK! msgfmt.slnnu[Microsoft Visual Studio Solution File, Format Version 11.00 # Visual Studio 2010 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "msgfmt", "msgfmt.vcxproj", "{5FF1D1A2-1630-446C-B6EA-93EFD4F975C3}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 Release|Win32 = Release|Win32 Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {5FF1D1A2-1630-446C-B6EA-93EFD4F975C3}.Debug|Win32.ActiveCfg = Debug|Win32 {5FF1D1A2-1630-446C-B6EA-93EFD4F975C3}.Debug|Win32.Build.0 = Debug|Win32 {5FF1D1A2-1630-446C-B6EA-93EFD4F975C3}.Debug|x64.ActiveCfg = Debug|x64 {5FF1D1A2-1630-446C-B6EA-93EFD4F975C3}.Debug|x64.Build.0 = Debug|x64 {5FF1D1A2-1630-446C-B6EA-93EFD4F975C3}.Release|Win32.ActiveCfg = Release|Win32 {5FF1D1A2-1630-446C-B6EA-93EFD4F975C3}.Release|Win32.Build.0 = Release|Win32 {5FF1D1A2-1630-446C-B6EA-93EFD4F975C3}.Release|x64.ActiveCfg = Release|x64 {5FF1D1A2-1630-446C-B6EA-93EFD4F975C3}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal PK!##main.cppnu[/********************************************************************** * © 2016 and later: Unicode, Inc. and others. * License & terms of use: http://www.unicode.org/copyright.html#License *********************************************************************** *********************************************************************** * COPYRIGHT: * Copyright (c) 1999-2003, International Business Machines Corporation and * others. All Rights Reserved. ***********************************************************************/ #include "unicode/unistr.h" #include "unicode/msgfmt.h" #include "unicode/calendar.h" #include #include #include "util.h" // The message format pattern. It takes a single argument, an integer, // and formats it as "no", "one", or a number, using a NumberFormat. static UnicodeString PATTERN( "Received {0,choice,0#no arguments|1#one argument|2#{0,number,integer} arguments}" " on {1,date,long}." ); int main(int argc, char **argv) { UErrorCode status = U_ZERO_ERROR; UnicodeString str; FieldPosition pos; // Create a message format MessageFormat msg(PATTERN, status); check(status, "MessageFormat::ct"); // Create the argument list Formattable msgArgs[2]; msgArgs[0].setLong(argc-1); msgArgs[1].setDate(Calendar::getNow()); // Format the arguments msg.format(msgArgs, 2, str, pos, status); check(status, "MessageFormat::format"); printf("Message: "); uprintf(str); printf("\n"); printf("Exiting successfully\n"); return 0; } PK!G[dutil.cppnu[/********************************************************************** * © 2016 and later: Unicode, Inc. and others. * License & terms of use: http://www.unicode.org/copyright.html#License *********************************************************************** *********************************************************************** * COPYRIGHT: * Copyright (c) 1999-2010, International Business Machines Corporation and * others. All Rights Reserved. ***********************************************************************/ #include "unicode/unistr.h" #include #include using namespace icu; // Verify that a UErrorCode is successful; exit(1) if not void check(UErrorCode& status, const char* msg) { if (U_FAILURE(status)) { printf("ERROR: %s (%s)\n", u_errorName(status), msg); exit(1); } // printf("Ok: %s\n", msg); } // Append a hex string to the target static UnicodeString& appendHex(uint32_t number, int8_t digits, UnicodeString& target) { static const UnicodeString DIGIT_STRING("0123456789ABCDEF"); while (digits > 0) { target += DIGIT_STRING[(number >> ((--digits) * 4)) & 0xF]; } return target; } // Replace nonprintable characters with unicode escapes UnicodeString escape(const UnicodeString &source) { int32_t i; UnicodeString target; target += "\""; for (i=0; i 0x0A && ch < 0x20) || ch > 0x7E) { target += "\\u"; appendHex(ch, 4, target); } else { target += ch; } } target += "\""; return target; } // Print the given string to stdout void uprintf(const UnicodeString &str) { char *buf = 0; int32_t len = str.length(); // int32_t bufLen = str.extract(0, len, buf); // Preflight /* Preflighting seems to be broken now, so assume 1-1 conversion, plus some slop. */ int32_t bufLen = len + 16; int32_t actualLen; buf = new char[bufLen + 1]; actualLen = str.extract(0, len, buf/*, bufLen*/); // Default codepage conversion buf[actualLen] = 0; printf("%s", buf); delete [] buf; } PK!msgfmt.vcxproj.filtersnu[ {ee7c4dbe-02ac-43f8-89cf-260b2bebecc9} cpp;c;cxx;rc;def;r;odl;idl;hpj;bat {b140c5d1-fe3d-4fbc-9931-fd1a6a555dc7} h;hpp;hxx;hm;inl {66a2f758-b543-469a-a2c9-754e37e23a81} ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe Source Files Source Files PK!~kooutil.hnu[PK!?MVqqMakefilenu[PK!##Nanswers/main_3.cppnu[PK!h answers/main_2.cppnu[PK!`__answers/main_1.cppnu[PK!answers/main_0.cppnu[PK!XP&&umsgfmt.vcxprojnu[PK!