-
Notifications
You must be signed in to change notification settings - Fork 0
/
1239.c
58 lines (50 loc) · 1.04 KB
/
1239.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
52
53
54
55
56
57
58
/*
autor: Virna Amaral
data: 22/03/2023
nome: Atalhos Bloggo
*/
#include <stdio.h>
#include <string.h>
char new_string(char frase[50]);
int main(){
char ch, frase[50];
while((ch=getchar())!=EOF){
int i=0;
memset(frase, 0, 50);
while(ch!='\n'){
frase[i] = ch;
i++;
ch = getchar();
}
new_string(frase);
}
}
char new_string(char frase[50]){
int j=0, k=0;
char c;
int len = strlen(frase);
for(int p=0;p<len;p++){
c = frase[p];
if(c=='*'){
if(j==0){
printf("<b>");
j++;
}else if(j==1){
printf("</b>");
j--;
}
}else if(c=='_'){
if(k==0){
printf("<i>");
k++;
}else if(k==1){
printf("</i>");
k--;
}
}else{
printf("%c", c);
}
}
printf("\n");
return 0;
}