在了解如何在不使用字符串转换函数的情况下将大写字母转换为小写字母之前,让我们来看一下使用转换函数将大写字母转换为小写字母的程序,然后您将清楚我们在程序中所做的事情:
示例
#include #include int main(){ char string[50]; printf("enter a string to convert to lower case"); gets(string); /reading the string printf("The string in lower case: %s
", strlwr(string)); //strlwr converts all upper to lower return 0;}
登录后复制
输出
enter a string to convert to lower caseCProgramming LangUageThe string in lower case: cprogramming language
登录后复制
现在让我们看看不使用预定义函数将大写转换为小写的程序 –
示例
#includevoid main(){ //Declaring variable for For loop (to read each position of alphabet) and string// int i; char string[40]; //Reading string// printf("Enter the string : "); gets(string); //For loop to read each alphabet// for(i=0;string[i]!='';i++){ if(string[i]>=65&&string[i]输出
Enter the string : TUTORIALSPOINTThe converted lower case string is : tutorialspoint登录后复制
以上就是编写一个C程序,将大写字母转换为小写字母,不使用字符串转换函数的详细内容,更多请关注【创想鸟】其它相关文章!
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至253000106@qq.com举报,一经查实,本站将立刻删除。
发布者:PHP中文网,转转请注明出处:https://www.chuangxiangniao.com/p/2585257.html