Изменил(а) на 'lab04/lab04-pdf.cpp'

main
GorokhovDE 4 месяцев назад
Родитель 0927d1b42a
Сommit 656b584b29

@ -6,7 +6,7 @@
#include <cstddef>
#include <string>
// 1. Функции для печати данных
// 1. &#1060;&#1091;&#1085;&#1082;&#1094;&#1080;&#1080; &#1076;&#1083;&#1103; &#1087;&#1077;&#1095;&#1072;&#1090;&#1080; &#1076;&#1072;&#1085;&#1085;&#1099;&#1093;
void print_in_hex(uint8_t byte) {
std::cout << std::hex << std::setw(2) << std::setfill('0') << static_cast<int>(byte) << ' ';
}
@ -36,7 +36,7 @@ void print_in_binary(const void* data, size_t size) {
std::cout << '\n';
}
// 2. Калькулятор для побитовых операций
// 2. &#1050;&#1072;&#1083;&#1100;&#1082;&#1091;&#1083;&#1103;&#1090;&#1086;&#1088; &#1076;&#1083;&#1103; &#1087;&#1086;&#1073;&#1080;&#1090;&#1086;&#1074;&#1099;&#1093; &#1086;&#1087;&#1077;&#1088;&#1072;&#1094;&#1080;&#1081;
void bitwise_calculator() {
uint16_t operand1, operand2;
char operation;
@ -65,7 +65,7 @@ void bitwise_calculator() {
print_in_binary(&result, sizeof(result));
}
// 3. Работа со структурами
// 3. &#1056;&#1072;&#1073;&#1086;&#1090;&#1072; &#1089;&#1086; &#1089;&#1090;&#1088;&#1091;&#1082;&#1090;&#1091;&#1088;&#1072;&#1084;&#1080;
struct Student {
char name[17];
uint16_t year_of_admission;
@ -110,7 +110,7 @@ void analyze_students() {
<< ", Size=" << sizeof(student.completed_courses) << '\n';
}
// 4. Обработка текстового файла
// 4. &#1054;&#1073;&#1088;&#1072;&#1073;&#1086;&#1090;&#1082;&#1072; &#1090;&#1077;&#1082;&#1089;&#1090;&#1086;&#1074;&#1086;&#1075;&#1086; &#1092;&#1072;&#1081;&#1083;&#1072;
void process_text_file() {
const char* filename = "text.txt";
@ -151,7 +151,7 @@ int main() {
switch (choice) {
case 1:
// Демонстрация функций печати
// &#1044;&#1077;&#1084;&#1086;&#1085;&#1089;&#1090;&#1088;&#1072;&#1094;&#1080;&#1103; &#1092;&#1091;&#1085;&#1082;&#1094;&#1080;&#1081; &#1087;&#1077;&#1095;&#1072;&#1090;&#1080;
{
uint16_t data = 0xABCD;
std::cout << "Hexadecimal output:\n";

Загрузка…
Отмена
Сохранить