////This program converts a string into an lowercase string
#include <iostream>
#include <ctype.h>
using namespace std; //Allows computer to output data
//declaring the function prototype
void converToLowercase(char *);
main() //main function begins
{
char str[30] = "WELCOME to VIRTUAL UNIVERSIty";
//char fstr;
cout << "The string before conversion is:\t" << str;
converToLowercase(str);
cout << "\nThe string after conversion is:\t\t" << str;
}//end of main function
void converToLowercase(char *sptr)
{
while(*sptr!='\0')
{
if (isupper(*sptr))
{
*sptr=tolower(*sptr);
}
++sptr;
}
}
#include <iostream>
#include <ctype.h>
using namespace std; //Allows computer to output data
//declaring the function prototype
void converToLowercase(char *);
main() //main function begins
{
char str[30] = "WELCOME to VIRTUAL UNIVERSIty";
//char fstr;
cout << "The string before conversion is:\t" << str;
converToLowercase(str);
cout << "\nThe string after conversion is:\t\t" << str;
}//end of main function
void converToLowercase(char *sptr)
{
while(*sptr!='\0')
{
if (isupper(*sptr))
{
*sptr=tolower(*sptr);
}
++sptr;
}
}
No comments:
Post a Comment