⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 program_3_4.cpp

📁 c++程序设计讲义 cppprograming 含源码
💻 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 + -