-
Notifications
You must be signed in to change notification settings - Fork 0
/
texth1.c
51 lines (44 loc) · 1.18 KB
/
texth1.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include <stdio.h>
#include <string.h>
int main()
{
int n;
int ol = 1;
// Input the number of lines
printf("Enter the number of lines: ");
scanf("%d", &n);
// Create a 2D array to store the lines of text
char alls[n][50];
// Read the input text and store it in the array
for (int i = 0; i < n; i++)
{
printf("Enter line %d: ", i + 1);
scanf("%s", alls[i]);
}
// Process each line of text
for (int i = 0; i < n; i++)
{
// Check for heading level 1
if (strcmp(alls[i], "h1") == 0)
{
printf("//");
// Print the top border
for (int j = 0; j < strlen(alls[i + 1]) + 2; j++)
{
printf("=");
}
printf("\\\\\n");
// Print the heading text
printf("|| %s ||\n", alls[i + 1]);
// Print the bottom border
printf("\\\\");
for (int j = 0; j < strlen(alls[i + 1]) + 2; j++)
{
printf("=");
}
printf("//\n");
}
// Add other conditional statements here for different formatting options...
}
return 0;
}