一、题目链接
http://noi.openjudge.cn/ch0107/13/
二、解题思路(Java)
三、解题思路(C++)
四、Java程序
import java.util.Scanner;
public class Main {
public String lowerToUpper(String text) {
return text.toUpperCase();
}
public static void main(String[] args) {
Main test = new Main();
Scanner input = new Scanner(System.in);
String text = input.nextLine();
System.out.print(test.lowerToUpper(text));
}
}
五、C++程序
#include <iostream>
using namespace std;
int main()
{
string text;
getline(cin, text);
int n = text.length();
for (int i = 0; i < n; i++)
{
if (islower(text[i]))
{
text[i] = toupper(text[i]);
}
}
cout << text;
return 0;
}