-->
Showing posts with label WAP to convert string into lowercase.PAss string as parameter and return as an output.. Show all posts
Showing posts with label WAP to convert string into lowercase.PAss string as parameter and return as an output.. Show all posts

WAP to convert string into lowercase.PAss string as parameter and return as an output.

in turbo c++
----------------------------------------------------------------------------

//WAP to convert a string into lowercase using(strlwr()) function.Pass string as parameter and return its result
#include <stdio.h>
#include<string.h>
#include<conio.h>
char *stringlwr(char string[]);//prototype of function(must as pointer)
int main()
{
    char name[100];// declaration
    printf("enter first string\n");
    //fgets(name, sizeof (name), stdin);//can be used
    gets(name); //string input
    printf("string in lowercase=%s\n",stringlwr(name));//prints with calling
     getch();
    return 0;
}
char *stringlwr(char string[])
{
    strlwr(string);
    return string;
}

----------------------------------------------------------------------------------------------------
in codeblocks:
------------------------------------------------------------------------------------------------
//WAP to convert a string into lowercase using(strlwr()) function.Pass string as parameter and return its result
#include <stdio.h>
#include<string.h>
#include<conio.h>
char *stringlwr(char string[]);//prototype of function(must as pointer)
int main()
{
    char name[100];// declaration
    printf("enter first string\n");
    //fgets(name, sizeof (name), stdin);//can be used
    gets(name); //string input
    printf("string in lowercase=%s\n",stringlwr(name));//prints with calling
     getch();
    return 0;
}
char *stringlwr(char string[])
{
    strlwr(string);
    return string;
}