📄 program_3_4.cpp
字号:
#include <iostream>
#include <string>
using namespace std;
int main()
{
// Prompt for and read the date
cout << "Enter the date in American format "
<< "(e.g., December 29, 1953): ";
char buffer[100];
string Date;
cin.getline(buffer, 100);
// Get the month by finding the first blank character
Date = buffer;
int i = Date.find(" ");
string Month = Date.substr(0, i);
// Get the day by finding the comma character
int k = Date.find(",");
string Day = Date.substr(i+1, k-i-1);
// Get the year by getting the substring from the blank
// following the comma through the end of the string
string Year = Date.substr(k+2, Date.size());
string NewDate = Day + " " + Month + " " + Year;
cout << "Original date: " << Date << endl;
cout << "Converted date: " << NewDate << endl;
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -