-->

WAP to find length of string without strlen() function.

using turbo c++
----------------------------------------------------------------------------------------------------------------
//wap to find the lenght of given string with out strlen()
#include <stdio.h>
#include<conio.h>
int main()
{
    char string[100];
    int count=0,i;
    printf("enter string\n");
    gets(string);
    for(i=0;string[i]!='\0';i++)
    {
        count++;
    }
    printf("length=%d",count);
    getch();
    return 0;
}






-------------------------------------------------------------------------------
using codeblocks
------------------------------------------------------------------------------------------------------------
//wap to find the lenght of given string
#include <stdio.h>

int main()
{
    char string[100];
    int count=0,i;
    printf("enter string\n");
    gets(string);
    for(i=0;string[i]!='\0';i++)
    {
        count++;
    }
    printf("length=%d",count);

    return 0;
}



or

------------------------------
//wap to find the lenght of given string
#include <stdio.h>

int main()
{
    char string[100];
    int i;
    printf("enter string\n");
    gets(string);
    for(i=0;string[i]!='\0';i++);// loop execution.; no body line; it just takes last value of i.
   
    printf("length=%d",i);

    return 0;
}


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;
}