137. Write a program to lowercase string without using strlwr()?

#include<iostream.h> #include<conio.h> #include<string.h> void main() {                 char str[10];                 clrscr();                 cout<<"Enter The String : ";                 cin>>str;                 cout<<"\nThe Lowercase of "<<str<<" : ";                 for(int i=0;i<strlen(str);i++)                                 {                                 if((str[i]>=65) && (str[i]<=90))                                                 {                                                 str[i]=str[i]+32;                                                 }                                 }                 cout<<str;                 getch(); }

Advertisements

136. Write a program to lowercase string using strlwr()?

#include<iostream.h> #include<conio.h> #include<string.h> void main() {                 char str[10];                 clrscr();                 cout<<"Enter The String : ";                 cin>>str;                 cout<<"\nThe String In Lowercase : "<<strlwr(str);                 getch(); }

135. Write a program to uppercase string without using strupr()?

#include<iostream.h> #include<conio.h> #include<string.h> void main() {                 char str[10];                 clrscr();                 cout<<"Enter The String : ";                 cin>>str;                 cout<<"\nThe Uppercase of "<<str<<" : ";                 for(int i=0;i<strlen(str);i++)                                 {                                 if((str[i]>=97) && (str[i]<=122))                                                 {                                                 str[i]=str[i]-32;                                                 }                                 }                 cout<<str;                 getch(); }

134. Write a program to uppercase string using strupr()?

#include<iostream.h> #include<conio.h> #include<string.h> void main() {                 char str[10];                 clrscr();                 cout<<"Enter The String : ";                 cin>>str;                 cout<<"\nThe String In Uppercase : "<<strupr(str);                 getch(); }

133. Write a program to reverse string without using strrev()?

#include<iostream.h> #include<conio.h> #include<string.h> void main() {                 char str[10],temp;                 int i,j;                 clrscr();                 cout<<"Enter The String : ";                 cin>>str;                 cout<<"\nThe Reverse of "<<str<<" : ";                 j=strlen(str)-1;                 for(i=0;i<j;i++)                                 {                                 temp=str[i];                                 str[i]=str[j];                                 str[j]=temp;                                 j--;                                 }                 cout<<str;                 getch(); }

132. Write a program to reverse string using strrev()?

#include<iostream.h> #include<conio.h> #include<string.h> void main() {                 char str[10];                 clrscr();                 cout<<"Enter The String : ";                 cin>>str;                 cout<<"\nReverse of "<<str;                 cout<<" Is "<<strrev(str);                 getch(); }

131. Write a program to concatenation two string without using strcat()?

#include<iostream.h> #include<conio.h> #include<string.h> void main() {                 char str1[10],str2[10];                 int i,l;                 clrscr();                 cout<<"Enter First String : ";                 cin>>str1;                 cout<<"Enter Second String : ";                 cin>>str2;                 l=strlen(str1);                 for(i=l;i<(l+strlen(str2));i++)                                 {                                 str1[i]=str2[i-l];                                 }                 cout<<"The Value Inside Str1 : "<<str1<<" And Inside Str2 : "<<str2;                 getch(); }

130. Write a program to concatenation two string using strcat()?

#include<iostream.h> #include<conio.h> #include<string.h> void main() {                 char str1[10],str2[10];                 clrscr();                 cout<<"Enter First String : ";                 cin>>str1;                 cout<<"Enter Second String : ";                 cin>>str2;                 strcat(str1,str2);                 cout<<"\nThe Value Inside Str1 : "<<str1<<" And Inside Str2 : "<<str2;                 getch(); }

129. Write a program to copy one string to another string without using strcpy()?

#include<iostream.h> #include<conio.h> #include<string.h> char str2[10]; void main() {                 char str1[10];                 int i;                 clrscr();                 cout<<"Enter A String : ";                 cin>>str1;                 for(i=0;i<strlen(str1);i++)                                 {                                 str2[i]=str1[i];                                 }                 cout<<"\nThe Value Inside Str1 = "<<str1<<" And Inside Str2 = "<<str2;                 getch(); }

Create a website or blog at WordPress.com

Up ↑

%d bloggers like this: