channel link : h ps://www.youtube.
com/c/ComputerScienceAcademy7
video link : h ps://youtu.be/3oLUIE9VtGw
/*
String func ons : C++ Compiler has a large set of useful string handling
library func os.
header file <string.h>
1. strlen() : This func on counts number of characters in the string.
(It returns length of the string)
*/
/* #include<iostream.h>
#include<conio.h>
#include<string.h>
void main()
{
clrscr();
int len1 = strlen("ABC");
cout<<"Length 1 = "<<len1<<endl;
char str[100] = "Hello Class";
int len2 = strlen(str);
cout<<"Lenght 2 = "<<len2<<endl;
cout<<"Enter any text: ";
cin.get(str, 100, '\n');
int len3 = strlen(str);
cout<<"length of enterd string : "<<len3;
getch();
}
*/
/*
2. strcpy() : This func on copies the content of one string into
another.
*/
/* #include<iostream.h>
#include<conio.h>
#include<string.h>
void main()
{
clrscr();
char line1[10] = "Computer";
char line2[10];
strcpy(line2, line1); // line2 = line1;
cout<<"line 1 = "<<line1<<endl;
cout<<"line 2 = "<<line2;
getch();
}
*/
/*
3. strcat() : This func on concatenates the source string at the end
of the target string.
*/
/*
#include<iostream.h>
#include<conio.h>
#include<string.h>
void main()
{
clrscr();
char line1[50] = "Computer ";
char line2[50] = "Science";
strcat(line1, line2); // line1 = line1 + line2;
cout<<"line 1 = "<<line1<<endl;
cout<<"line 2 = "<<line2;
getch();
}
*/
/*
4. strupr() : This func on convert string into upparcase format.
5. strlwr() : This func on convert string into lowercase format.
*/
/*
#include<iostream.h>
#include<conio.h>
#include<string.h>
void main()
{
clrscr();
char line1[50] = "computer ";
char line2[50] = "SCIENCE";
strupr(line1);
strlwr(line2);
cout<<"line 1 = "<<line1<<endl;
cout<<"line 2 = "<<line2;
getch();
}
*/
// 6. strrev() : This func on convert string into reverse string.
/*
#include<iostream.h>
#include<conio.h>
#include<string.h>
void main()
{
clrscr();
char line1[50] = "computer ";
char line2[50] = "SCIENCE";
strrev(line1);
strrev(line2);
cout<<"line 1 = "<<line1<<endl;
cout<<"line 2 = "<<line2;
getch();
}
*/
/* 7. strcmp() : This func on compares two string to find out whether
they are same or differnt. */
/*
#include<iostream.h>
#include<conio.h>
#include<string.h>
void main()
{
clrscr();
char str1[50] ="Hello";
char str2[50] ="Hello";
int diff = strcmp(str1, str2);
cout<<diff<<endl;
if(diff == 0)
cout<<"both are same";
else
cout<<"they are different";
getch();
}
*/
/* WAP in C++ to read any word or text of line and check whether it is
palindrome word/text or not; */
// 121 \ 121 ni n / ni n nayan / nayan
/* #include<iostream.h>
#include<conio.h>
#include<string.h>
void main()
{
clrscr();
char str[50], rev[50];
cout<<"Enter any word: ";
cin.get(str, 50, '\n');
strcpy(rev, str); // rev = str
strrev(rev);
int diff = strcmp(str, rev);
if(diff == 0)
cout<<"Its palindrome word";
else
cout<<"Its not palindrome word";
getch();
}
*/