programplug Logo




C strlen() Method


#include
void main()
{    
   char ch[10]={'h','e','l','l','o'};    
   cout<<"Length of string is:"<< strlen(ch);       
}   

Output
Length of string is:
5

C strcpy() Method


#include   
void main()
{    
   char ch[10]={'h','e','l','l','o'};    
   char ch2[10];    
   strcpy(ch2,ch);    
   cout<<"Value of second string is:" << ch2;       
}   

Output
Value of second string is:
hello

C strcat() Method


#include   
void main()
{    
   char ch[10]={'h', 'e', 'l', 'l', 'o'};    
   char ch2[10]={'w','o','l','d'};    
   strcat(ch,ch2);    
   cout<<"Value of string is:" << ch;       
}    

Output
Value of string is:
Value of first string is: hello world

C strcmp() Method


#include   
void main()
{    
  char s1[10],s2[10];    
  cout<<"Enter string 1:";    
  cinr>>s1;   
  cout<<"Enter string 2:";    
  cin>>s2;    
  if(strcmp(s1,s2)==0)    
      cout<<"Strings are equal";    
  else    
      cout<<"Strings are not equal";    
}  

Output
Enter string 1: hello
Enter string 2: hello
Strings are equal

C strrev() Method


#include     
void main()
{    
  char s[10];    
  cout<<"Enter string: ";       
  cin>>s;    
  cout<<"Reverse String is:" << strrev(s);       
}    

Output
Enter string:Hello
Reverse String is: olleH

C strlwr() Method


#include     
void main()
{    
  char s[10];    
  cout<<"Enter string: ";    
  gets(str);   
  cout<< s;    
  cout<<"Lower String is:" << strlwr(s);        
}     

Output
Enter string:HELLO
Lower String is: hello

C strupr() Method


#include    
void main()
{    
  char s[10];    
  cout<<"Enter string:" << str;         
  cout<<"Upper String is:" << strupr(s);    
 return 0;    
}        

Output
Enter string:hello
Upper String is: HELLO






Our Services

Developing Cheapest Websites
Offer Digital Marketing
Provide College Projects
Attractive Website Developing
Summer Training,Industrial Training
SCO,SMO

Contact Us

Dehradun Uttarakhand India
www.programplug.com
info@programplug.com
000000000

Other Link

About Us

Contact Us

Disclaimer

Privacy Policy