How to underline input string in c language.
#include <stdio.h>
#include <string.h>
main(){
printf("Enter String\n");
gets(usr);
puts(usr);
}
How to underline input string in c language.
#include <stdio.h>
#include <string.h>
main(){
printf("Enter String\n");
gets(usr);
puts(usr);
}
I don't know about windows on linux this is pretty simple
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int main(int argc, char **argv)
{
char text[100];
if (fgets(text, sizeof(text), stdin) != NULL)
{
size_t length;
length = strlen(text);
if (text[length - 1] == '\n')
text[length - 1] = '\0';
printf("the following text \033[4m");
printf("%s", text);
printf("\033[24m, was underlined\n");
}
return 0;
}
Basically wrapping the text around "\e[4m"
and "\e[24m"
does it, the former enables underlined text, and the latter disables it. You can search google for BASH escape sequences
for colors and other stuff.
You can also create a function that underlines a certain string, although that's not so easy in c as it is in Java.