Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
117269 | 成书骏 | 06输出日期 | C++ | Wrong Answer | 0 MS | 264 KB | 695 | 2025-04-15 22:13:16 |
#include <iostream> #include <sstream> int main() { std::string inputDate; std::cout << "请输入日期(格式:日-月-年): "; std::getline(std::cin, inputDate); std::stringstream ss(inputDate); std::string day, month, year; // 分割输入字符串 if (std::getline(ss, day, '-') && std::getline(ss, month, '-') && std::getline(ss, year)) { // 输出重新排列后的日期格式 std::cout << "输出日期(格式:月-日-年): " << month << "-" << day << "-" << year << std::endl; } else { std::cerr << "输入日期格式错误,请确保格式为 日-月-年" << std::endl; } return 0; }
------Input------
30-2016-7
------Answer-----
7-30-2016
------Your output-----
请输入日期(格式:日-月-年): 输出日期(格式:月-日-年): 2016-30-7