

c:
#include<stdio.h>
int main()
{
char a;
while(scanf("%c",&a)!=EOF){//EOF每一行结束的标志
getchar();//吞掉回车键
printf("%c\n",a+32);
}
}
c++:
#include<bits/stdc++.h>
using namespace std;
int main(){
char a,b;
//cin>>(int)a>>(int)b;
//a=a+32;
//b=b+32;
//cout<<a<<"\n"<<b;
while(cin>>a){
cout<<char(a+32)<<endl;
//cout换行用endl;
}
}
Java:
import java.io.*;
public class Main{
public static void main(String[]args)throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
//String a=String
// String str=null;
String a;
while((a=br.readLine())!=null){
//System.out.printf("%c",a+32);
System.out.println(a.toLowerCase());
}
//char b=s.charAt(1);
//char的读取:https://blog.csdn.net/marcotsui/article/details/108139975
}
}
//a.toLowerCase();null;while循环检测输入,不用两次都考虑
这篇博客介绍了如何使用C、C++和Java编程语言,通过while循环实现用户输入两行大写字母并将其转换为小写字母的功能。示例代码分别展示了三种语言的实现方式。

444

被折叠的 条评论
为什么被折叠?



