Write a program to convert a string in lowercase

Write a C++ Program to Convert a String in Lowercase

Write a program to convert a string in lowercase

Object: Write a program to convert a string in lowercase. C++ Projects. C++ projects for beginners with source code

Code:

#include<iostream>
#include<conio.h>
#include<string>
using namespace std;
void main()
{
string tex;
int i;
cout<<“Enter the text in Upper case: “;
getline(cin,tex);
for(i=0;i<tex.length();i++)
{
tex[i]=tolower(tex[i]);
}
cout<<“Lower case is :”<<tex;
getch();
}

#include<iostream>
#include<conio.h>
#include<string>
using namespace std;
void main()
{
	string tex;
	int i;
	cout<<"Enter the text in Upper case: ";
	getline(cin,tex);
	for(i=0;i<tex.length();i++)
	{
		tex[i]=tolower(tex[i]);
	}
	cout<<"Lower case is :"<<tex;
	getch();
}

Output:

Write a program to convert a string in lowercase

1 thought on “Write a program to convert a string in lowercase”

  1. Pingback: C++ projects for beginners with source code - Codeboks

Leave a Comment

Your email address will not be published. Required fields are marked *