Advertisement
ResistanceJke

lab11

Dec 12th, 2019
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.12 KB | None | 0 0
  1. // Программа создаёт html файл, в который записываются строчки, указанные в файле. Если в строке есть слово, в котором повторяются 2 символа подря (zzsdf zxc xc - zz повторяется), то выделяет строку полу жирным курсивом
  2.  
  3. #include <iostream>
  4. #include <ctype.h>
  5. #include <conio.h>
  6. #include <stdio.h>
  7. #include <Windows.h>
  8.  
  9. int main()
  10. {
  11.     FILE* fin;
  12.     FILE* fout;
  13.     char str[255];
  14.     fopen_s(&fin, "D:\\temp\\in11.txt", "rt");
  15.     fopen_s(&fout, "D:\\temp\\ou11.html", "wt");
  16.     fgets(str, 255, fin);
  17.     fprintf(fout, "<HTML>\n<HEAD>\n<TITLE>%s</TITLE>\n</HEAD>\n<BODY>", &str);
  18.  
  19.     fprintf(fout, "<H1>%s</H1>", str);
  20.     while (!feof(fin))
  21.     {
  22.         fgets(str, 255, fin);
  23.         int i = 0;
  24.         int asd = 0;
  25.         while (str[i] != 0)
  26.         {
  27.             if (str[i] == str[i+1])
  28.             {
  29.                 asd++;
  30.             }
  31.             i++;
  32.         }
  33.         if (asd > 0)
  34.         {
  35.             fprintf(fout, "<i><b>%s</i></b><BR>", str);
  36.         }
  37.         else
  38.         {
  39.             fprintf(fout, "%s<BR>", str);
  40.         }
  41.  
  42.         str[0] = 0;
  43.     }
  44.  
  45.     fclose(fout);
  46.     fclose(fin);
  47.     return 0;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement