L1-035 Valentine's Day (15 points)

Here Insert Picture Description
These are a wonderful circle of friends posted: "February 14 Valentine's Day, I decided for the benefit of everyone 2nd praise and praise 14, I introduced you two know ............ we eat ... three ... two of you please. . " Friends list now gives thumbs up at this post, please find out that you want to treat two hapless.

Input formats:

Enter the thumbs up in accordance with the order given how many points like this do not know the names, each name per line, to no more than 10 letters of non-empty words, ending with a carriage return. An English period. Marks the end of the input, this symbol is not at the point of praise list.

Output formats:

Output based on the dot Like the case of a line conclusion: If there is the second individual A and the 14 individual B, the output "A and B are inviting you to dinner ..."; if A but not B, then output "A is the only one for you ... "; even if A did not, then output" Momo ... no one is for you ... ".

Sample Input 1:

GaoXZh
Magi
Einst
Quark
LaoLao
FatMouse
ZhaShen
fantacy
latesum
SenSen
QuanQuan
whatever
whenever
Potaty
hahaha
.

Output Sample 1:

Magi and Potaty are inviting you to dinner...

Sample Input 2:

LaoLao
FatMouse
whoever
.

Output Sample 2:

FatMouse is the only one for you...

Sample Input 3:

LaoLao
.

Sample Output 3:

Momo... No one is for you ...

Code:

#include<iostream>
#include<string>
const int N = 55;
using namespace std;
int main() 
{
	string s[55];
	int flag = 1;
	int i;
	
	while(flag)
	{
		for(i = 0; i < N; i++ )
		{
			getline(cin, s[i]);

			if(s[i] == ".") break;
		}
		flag = 0;
	}
	
	if(s[14] != "" && s[2] != "") 
		cout << s[1] << " and " << s[13] << " are inviting you to dinner..." ;
		
	if(s[14] == "")
	{
		if(s[2] != "")
			cout << s[1] << " is the only one for you...";
		else
			cout << "Momo... No one is for you ..."; 
	} 
	return 0;
	 
}
Published 69 original articles · won praise 218 · views 10000 +

Guess you like

Origin blog.csdn.net/weixin_45895026/article/details/104362537