Advertisement
ResistanceJke

lab11 string html

Dec 2nd, 2019
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.78 KB | None | 0 0
  1. #include <iostream>
  2. #include <ctype.h>
  3. #include <conio.h>
  4. #include <stdio.h>
  5. #include <Windows.h>
  6.  
  7. int main()
  8. {
  9.     FILE* fin;
  10.     FILE* fout;
  11.     char str[255];
  12.     fopen_s(&fin, "D:\\temp\\lab11i.txt", "rt");
  13.     fopen_s(&fout, "D:\\temp\\lab11o.html", "wt");
  14.     fgets(str, 255, fin);
  15.     fprintf(fout, "<HTML>\n<HEAD>\n<TITLE>%s</TITLE>\n</HEAD>\n<BODY>", &str);
  16.  
  17.     fprintf(fout, "<H1>%s</H1>", str);
  18.     while (!feof(fin))
  19.     {
  20.         fgets(str, 255, fin);
  21.         int i = 0;
  22.         int asd = 0;
  23.         while (str[i] != 0)
  24.         {
  25.             if (str[i] == 'a' || str[i] == 'A')
  26.             {
  27.                 str[i] = '*';
  28.                 asd++;
  29.             }
  30.             i++;
  31.         }
  32.         if (asd > 0)
  33.         {
  34.             fprintf(fout, "<i><b>%s</b></i><BR>", str);
  35.         }
  36.         else
  37.         {
  38.             fprintf(fout, "%s<BR>", str);
  39.         }
  40.  
  41.         str[0] = 0;
  42.     }
  43.  
  44.     fclose(fout);
  45.     fclose(fin);
  46.     return 0;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement