-->

WAP to compare two strings using strcmp() function.

using turboc++
---------------------------------------------------------------------------------------------------------------------
//WAP to compare  two strings  using(strcmp()) function.
#include <stdio.h>
#include<string.h>
#include<conio.h>
int main()
{
    char st[100],st1[100];//two string declaration
    printf("enter first string\n");
    gets(st);
    printf("enter second string\n");
     gets(st1);//inputs
    if(strcmp(st,st1)>0)//
    {
        printf("%s has more ascii value than %s",st,st1);
    }
    else if(strcmp(st,st1)<0)
    {
        printf("%s has more ascii value than %s",st1,st);

    }
    else
    {
        printf("%s and %s have same ascii value",st,st1);
    }
getch();
    return 0;
}


---------------------------------------------------------------------------------------
using codeblocks
------------------------------------------------------------------------------------------------
//WAP to compare  two strings  using(strcmp()) function.
#include <stdio.h>
#include<string.h>
int main()
{
    char st[100],st1[100];//two string declaration
    printf("enter first string\n");
    gets(st);
    printf("enter second string\n");
     gets(st1);//inputs
    if(strcmp(st,st1)>0)//
    {
        printf("%s has more ascii value than %s",st,st1);
    }
    else if(strcmp(st,st1)<0)
    {
        printf("%s has more ascii value than %s",st1,st);

    }
    else
    {
        printf("%s and %s have same ascii value",st,st1);
    }
    return 0;
}


WAP to concatenate /merge two strings using strcat() function.

using turboc++
--------------------------------------------------------------------------------------------------
//WAP to merge  two strings  using(strcat()) function.
#include <stdio.h>
#include<string.h>
#include<conio.h>
int main()
{
    char st[100],st1[100];//two string declaration
    printf("enter first string\n");
    gets(st);
    printf("enter second string\n");
     gets(st1);//inputs
    strcat(st,st1);//merging st1 string into first (st)
    printf("merged string =%s\n",st);//prints the merged strings(st)
   getch();
    return 0;
}


---------------------------------------------------------------------------------------------------
using codeblocks
----------------------------------------------------------------------------------------------------
//WAP to merge  two strings  using(strcat()) function.
#include <stdio.h>
#include<string.h>
int main()
{
    char st[100],st1[100];//two string declaration
    printf("enter first string\n");
    gets(st);
    printf("enter second string\n");
     gets(st1);//inputs
    strcat(st,st1);//merging st1 string into first (st)
    printf("merged string =%s\n",st);//prints the merged strings(st)
    return 0;
}

WAP to copy a string using strcpy().

using turboc++
-------------------------------------------------------------------------------------------
//WAP to copy  a string  using(strcpy()) function.
#include <stdio.h>
#include<string.h>
int main()
{
    char st[100],st1[100];//two string declaration
    printf("enter first string\n");
    //fgets(name, sizeof (name), stdin);//to input string with space
    scanf("%[^\n]s",st); //it also CAN BE USED. IT accepts string with space until it meets new line
    strcpy(st1,st);//copying a string into first
    printf("copied string =%s\n",st1);//prints the copied name
    getch();
    return 0;
}

---------------------------------------------------------------------------------------
using codeblocks
-------------------------------------------------------------------------------------------------------------
//WAP to copy  a string  using(strcpy()) function.
#include <stdio.h>
#include<string.h>
int main()
{
    char st[100],st1[100];//two string declaration
    printf("enter first string\n");
    //fgets(name, sizeof (name), stdin);//to input string with space
    scanf("%[^\n]s",st); //it also CAN BE USED. IT accepts string with space until it meets new line
    strcpy(st1,st);//copying a string into first
    printf("copied string =%s\n",st1);//prints the copied name
    return 0;
}

WAP to convert string into lowercase using strlwr() function

using turbo c++
---------------------------------------------------------------------------
//WAP to convert  a string into lowercase using(strlwr()) function.
#include <stdio.h>
#include<string.h>
#include<conio.h>
int main()
{
    char name[100];//declaration
    printf("enter string\n");
    //fgets(name, sizeof (name), stdin);//to input string with space
    scanf("%[^\n]s",name); //it also CAN BE USED. IT accepts string with space until it meets new line
    strlwr(name);
    printf("string in lowercase=%s\n",name);//prints the name in lowercase
   getch();
    return 0;
}

--------------------------------------------------------------------------------------------------
using codeblocks
----------------------------------------------------------------------------------------------------------

//WAP to convert  a string into lowercase using(strlwr()) function.
#include <stdio.h>
#include<string.h>
int main()
{
    char name[100];//declaration
    printf("enter string\n");
    //fgets(name, sizeof (name), stdin);//to input string with space
    scanf("%[^\n]s",name); //it also CAN BE USED. IT accepts string with space until it meets new line
    strlwr(name);
    printf("string in lowercase=%s\n",name);//prints the name in lowercase
    return 0;
}

WAP to convert string into uppercase using strupr() function.

using turboc++
--------------------------------------------------------------------------------
//WAP to convert  a string into uppercase using(strupr()) function.
#include <stdio.h>
#include<string.h>
#include<conio.h>
int main()
{
    char name[100];//declaration
    printf("enter string\n");
    //fgets(name, sizeof (name), stdin);//to input string with space
    scanf("%[^\n]s",name); //it also CAN BE USED. IT accepts string with space until it meets new line
    strupr(name);
    printf("string in uppercase=%s\n",name);//prints the name in uppercase
   getch();
    return 0;
}


------------------------------------------------------------------------------------------------
using codeblocks
--------------------------------------------------------------------------------------------------
//WAP to convert  a string into uppercase using(strupr()) function.
#include <stdio.h>
#include<string.h>
int main()
{
    char name[100];//declaration
    printf("enter string\n");
    //fgets(name, sizeof (name), stdin);//to input string with space
    scanf("%[^\n]s",name); //it also CAN BE USED. IT accepts string with space until it meets new line
    strupr(name);
    printf("string in uppercase=%s\n",name);//prints the name in uppercase
    return 0;
}

WAP to reverse a string using(strrev()) function.

using turbo c++
-------------------------------------------
//WAP to reverse a string using(strrev()) function.
#include <stdio.h>
#include<string.h>
#include<conio.h>
int main()
{
    char name[100];//two dimensional declaration
    printf("enter string\n");
    //fgets(name, sizeof (name), stdin);
    scanf("%[^\n]s",name); //it also CAN BE USED. IT accepts string with space until it meets new line
    strrev(name);
    printf("reverse=%s\n",name);//prints the name
     getch();
    return 0;
}
-------------------------------------------------
in codeblocks
------------------------------------------------------
//WAP to reverse a string using(strrev()) function.
#include <stdio.h>
#include<string.h>
int main()
{
    char name[100];//two dimensional declaration
    printf("enter string\n");
    //fgets(name, sizeof (name), stdin);
    scanf("%[^\n]s",name); //it also CAN BE USED. IT accepts string with space until it meets new line
    strrev(name);
    printf("reverse=%s\n",name);//prints the name
    return 0;
}

//WAP to get /find length of string using(strlen()) function.

using turbo c++
--------------------------------------------------------------------------------------------
//WAP to get /find length of string using(strlen()) function.

#include <stdio.h>
#include<conio.h>
int main()
{
    char name[100];//two dimensional declaration
    int i,count=0;              //declaration with initialization
    printf("enter string\n");
    gets(name);
    for(i=0;name[i]!='\0';i++)//loop execution till it reaches \0 character
    {
        count++;            //counting goes on
    }
    printf("total length=%d\n",count);//prints the length
    getch();
     return 0;
}
-----------
or
---------------------
//WAP to get /find length of string using(strlen()) function.

#include <stdio.h>
#include<conio.h>
int main()
{
    char name[100];//two dimensional declaration
    int i;              //declaration with initialization
    printf("enter string\n");
    gets(name);
    for(i=0;name[i]!='\0';i++);//loop execution till it reaches \0 character; no body line.
    printf("total length=%d\n",i);//prints the length
    getch();
     return 0;
}

------------------------------------------------------------
using codeblocks:
-----------------------------------------------------------------------------
//WAP to get /find length of string using(strlen()) function.

#include <stdio.h>
int main()
{
    char name[100];//two dimensional declaration
    int i,count=0;              //declaration with initialization
    printf("enter string\n");
    gets(name);
    for(i=0;name[i]!='\0';i++)//loop execution till it reaches \0 character
    {
        count++;            //counting goes on
    }
    printf("total length=%d\n",count);//prints the length
   
     return 0;
}