-
-
Save dertst/3e31fa7769e62b5b5133e541def7c9be to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "pch.h" | |
#include <cstdio> | |
#include "string.h" | |
#include <conio.h> | |
#include <stdio.h> | |
#include <Windows.h> | |
int main() | |
{ | |
int size; | |
char *k[4]; | |
FILE *f; | |
int flag=0; | |
for (int i = 0; i < 4; i++) | |
{ | |
k[i] = (char*)malloc(15 * 4 * sizeof(char)); | |
} | |
fopen_s(&f, "C:\\temp\\input.txt", "rt"); | |
for (int i = 0; i < 4; i++) | |
{ | |
fgets(k[i],15,f); | |
} | |
fclose(f); | |
FILE *out; | |
fopen_s(&out, "C:\\temp\\output.html", "wt"); | |
fprintf(out, "<HTML>\n"); | |
fprintf(out, "<HEAD>\n"); | |
fprintf(out, "<TITLE>ЗАДАНИЕ-B</TITLE>\n"); | |
fprintf(out, "</HEAD>\n"); | |
fprintf(out, "<BODY>\n"); | |
fprintf(out, "<H1>"); | |
fputs(k[0], out); | |
fprintf(out, "</H1>\n"); | |
for (int i = 0; i < 4; i++) | |
{ | |
size = strlen(k[i]); | |
for (int j = 0; j < size; j++) | |
{ | |
if (k[i][j] == k[i][j + 1]) | |
{ | |
fprintf(out, "<i><b>"); | |
fputs(k[i], f); | |
fprintf(out, "</i></b>"); | |
flag = 1; | |
break; | |
} | |
} | |
if (flag == 0) | |
{ | |
fputs(k[i], f); | |
} | |
flag = 0; | |
} | |
fprintf(out, "</BODY>\n"); | |
fprintf(out, "</HTML>\n"); | |
fclose(out); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment