Skip to content

Commit

Permalink
string function
Browse files Browse the repository at this point in the history
  • Loading branch information
rakeshlinux committed Jul 5, 2018
1 parent 8ceda6d commit f1311ff
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 0 deletions.
12 changes: 12 additions & 0 deletions string/search_char.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include<iostream>
#include<string.h>
using namespace std;
int main()
{
char string1[70]="Vinay Is a GOOD bay";
char ch='v';
int n;
strchr(string1, ch);
cout<<"\n Value of n :"<<;
return 0;
}
21 changes: 21 additions & 0 deletions string/string_compare_function.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include<iostream>
#include<string.h>
using namespace std;
int main()
{
char string1[100]="vinay";
char string2[100]="amit";
int n;

n = strcmp(string1,string1);
if(n>0) {
cout<<"String 1 is greater than string 2";
}
if(n<0){
cout<<"String 2 is greater than string 1";
}
if(n==0){
cout<<"\n Both are equal";
}
return 0;
}
11 changes: 11 additions & 0 deletions string/string_concate_function.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include<iostream>
#include<string.h>
using namespace std;
int main()
{
char string1[7]="vinay";
char string2[100]="amit";
strcat(string1,string2);
cout<<"\n Concatenated string :"<<string1;
return 0;
}
10 changes: 10 additions & 0 deletions string/string_lower_case_function.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include<iostream>
#include<string.h>
using namespace std;
int main()
{
char string1[70]="Vinay Is a GOOD bay";
strlwr(string1);
cout<<"\n Lowercase string :"<<string1;
return 0;
}
10 changes: 10 additions & 0 deletions string/string_rev_function.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include<iostream>
#include<string.h>
using namespace std;
int main()
{
char string1[70]="vinay is a good boy";
strrev(string1);
cout<<"\n Reverse string :"<<string1;
return 0;
}
Binary file added string/string_rev_function.exe
Binary file not shown.
10 changes: 10 additions & 0 deletions string/string_upper_case.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include<iostream>
#include<string.h>
using namespace std;
int main()
{
char string1[70]="Vinay Is a GOOD bay";
strupr(string1);
cout<<"\n Uppercase string :"<<string1;
return 0;
}

0 comments on commit f1311ff

Please sign in to comment.