L1-035 情人節 (15分) 詳解

思路:

 這道題挺簡單的,就是統計名字數量而已。純粹就是這道題的題目讓我虎軀一震,挺有意思的哈哈哈

情人節VIP專屬題目

#include<iostream>
#include<vector>
#include<string>
using namespace std;
int main()
{

	vector<string> a;
	string s;
	cin >> s;
	while (!(s == "."))
	{
		a.push_back(s);
		cin >> s;
	}
	if (a.size() >= 14)
	{
		cout << a[1]<<" and "<<a[13]<<" are inviting you to dinner..." << endl;
	}
	else if (a.size() < 14&&a.size()>1)
	{
		cout << a[1]<<" is the only one for you..." << endl;
	}
	else if (a.size() < 2)
	{
		cout << "Momo... No one is for you ...";
	}
	system("pause");
	return 0;
}

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章