-->
Showing posts with label WAP to set all characters in the given string to the character using strset() function.. Show all posts
Showing posts with label WAP to set all characters in the given string to the character using strset() function.. Show all posts

WAP to set all characters in the given string to the character using strset() function.

in turboc++
----------------------------------------------------------------------------------------
//WAP to  string with other character  using(strset()) function.
#include <stdio.h>
#include<string.h>
#include<conio.h>
int main()
{
    char st[100],st1;// declaration
    printf("enter  string\n");
    gets(st);
    printf("enter a character to set for\n");
     st1=getchar();//inputs
    printf("string before setting=%s\n",st);
    strset(st,st1);
    printf("string after setting with character=%c is =%s\n",st1,st);
    getch();
    return 0;
}
-------------------------------------------------------------------------------------------
in codeblocks:
-----------------------------------------------------------------------------------------
//WAP to  string with other character  using(strset()) function.
#include <stdio.h>
#include<string.h>
int main()
{
    char st[100],st1;// declaration
    printf("enter  string\n");
    gets(st);
    printf("enter a character to set for\n");
     st1=getchar();//inputs
    printf("string before setting=%s\n",st);
    strset(st,st1);
    printf("string after setting with character=%c is =%s\n",st1,st);
    return 0;
}