标签:朋友圈 The when string ... ever who 介绍 10个
以上是朋友圈中一奇葩贴:“2月14情人节了,我决定造福大家。第2个赞和第14个赞的,我介绍你俩认识…………咱三吃饭…你俩请…”。现给出此贴下点赞的朋友名单,请你找出那两位要请客的倒霉蛋。
输入按照点赞的先后顺序给出不知道多少个点赞的人名,每个人名占一行,为不超过10个英文字母的非空单词,以回车结束。一个英文句点.
标志输入的结束,这个符号不算在点赞名单里。
根据点赞情况在一行中输出结论:若存在第2个人A和第14个人B,则输出“A and B are inviting you to dinner...”;若只有A没有B,则输出“A is the only one for you...”;若连A都没有,则输出“Momo... No one is for you ...”。
GaoXZh
Magi
Einst
Quark
LaoLao
FatMouse
ZhaShen
fantacy
latesum
SenSen
QuanQuan
whatever
whenever
Potaty
hahaha
.
Magi and Potaty are inviting you to dinner...
LaoLao
FatMouse
whoever
.
FatMouse is the only one for you...
LaoLao
.
Momo... No one is for you ...
#include<bits/stdc++.h>
using namespace std;
int main()
{
//建立string a[15]
//i++循环
//若i>14,则置为14
//输入a[i]
//若输入a[i]为 . ,break
//判断i大小,三情况
string a[15];
int i = -1;
while(1)
{
i++;
if(i > 14) i = 14;
cin>>a[i];
if(a[i][0] == ‘.‘) break;
}
if(i < 2)
cout<<"Momo... No one is for you ...";
else if(i == 14)
cout<<a[1]<<" and "<<a[13]<<" are inviting you to dinner...";
else
cout<<a[1]<<" is the only one for you...";
return 0;
}
标签:朋友圈 The when string ... ever who 介绍 10个
原文地址:https://www.cnblogs.com/hear0/p/10539367.html