Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions zuenoksg/C_lab/Bitwise/Bitwise/Bitwise.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
// Bitwise.cpp: ���������� ����� ����� ��� ����������� ����������.
//

#include <stdio.h>
#include <tchar.h>
#include <stdint.h>
#include <Locale.h>

enum Style {
// (B � bold), (I � italic), (U � underline)
NONE = 0, // 0000
B = 1, // 0001
I = 1 << 1, // 0010
U = 1 << 2, // 0100
ALL = B | I | U // 0111
};

enum StlPrgf {
bold = 0x100, // 0001 0000 0000
italic = 0x100 << 1, // 0010 0000 0000
underline = 0x100 << 2, // 0100 0000 0000
all = bold | italic | underline, // 0111 0000 0000

Left = 0x800, // 0000 1000 0000 0000
Center = 0x800 << 1, // 0001 0000 0000 0000
Right = 0x800 << 2, // 0010 0000 0000 0000
Justify = 0x800 << 3, // 0100 0000 0000 0000
};

void PrintHtml(char const*, int);
void SetTextParagraphDisplay(uint32_t);

int main() {
setlocale(LC_ALL, "Russian");
char const* simple_string;

simple_string = "������";
PrintHtml(simple_string, ALL);
printf("\n");

simple_string = "Hello, World";
PrintHtml(simple_string, U | I);
printf("\n");

SetTextParagraphDisplay(bold | italic | underline | Left | 100);
printf("\n");

return 0;
}

void PrintHtml(char const* string, int style) {
char *out_B, *out_I, *out_U,
*out__B, *out__I, *out__U;

out_B = (style&B) ? "<B>" : "";
out_I = (style&I) ? "<I>" : "";
out_U = (style&U) ? "<U>" : "";
out__B = (style&B) ? "</B>" : "";
out__I = (style&I) ? "</I>" : "";
out__U = (style&U) ? "</U>" : "";

printf("%s%s%s%s%s%s%s", out_B, out_I, out_U, string, out__U, out__I, out__B);
};

void SetTextParagraphDisplay(uint32_t flags) {
char *out__b, *out__i, *out__u,
*out__L, *out__C, *out__R, *out__J;

printf("\nText paragraph display settings: %d\n", flags);

out__b = (flags&bold) ? "bold" : "";
out__i = (flags&italic) ? "italic" : "";
out__u = (flags&underline) ? "underline" : "";
out__L = (flags&Left) ? "Left" : "";
out__C = (flags&Center) ? "Center" : "";
out__R = (flags&Right) ? "Right" : "";
out__J = (flags&Justify) ? "Justify" : "";

if (flags & 0xFF00) {
printf("\nStyle: %s %s %s", out__b, out__i, out__u);
printf("\nHorAlign: %s %s %s %s", out__L, out__C, out__R, out__J);
}
printf("\nSize: %d", flags & 0xFF);
};
28 changes: 28 additions & 0 deletions zuenoksg/HomeWork1/HomeWork1.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26403.7
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HomeWork1", "HomeWork1\HomeWork1.vcxproj", "{DF16475D-7E73-444D-8C96-6A9B352423C7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DF16475D-7E73-444D-8C96-6A9B352423C7}.Debug|x64.ActiveCfg = Debug|x64
{DF16475D-7E73-444D-8C96-6A9B352423C7}.Debug|x64.Build.0 = Debug|x64
{DF16475D-7E73-444D-8C96-6A9B352423C7}.Debug|x86.ActiveCfg = Debug|Win32
{DF16475D-7E73-444D-8C96-6A9B352423C7}.Debug|x86.Build.0 = Debug|Win32
{DF16475D-7E73-444D-8C96-6A9B352423C7}.Release|x64.ActiveCfg = Release|x64
{DF16475D-7E73-444D-8C96-6A9B352423C7}.Release|x64.Build.0 = Release|x64
{DF16475D-7E73-444D-8C96-6A9B352423C7}.Release|x86.ActiveCfg = Release|Win32
{DF16475D-7E73-444D-8C96-6A9B352423C7}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Loading