0
I need i help pleas
You are grouped into groups for a project, and you are supposed to come up with as many famous scientists who have the same first letter of their name as you as possible. Will you have to come up with the answers on your own, or is there somebody in your group that you can work with? Task: Determine if anyone in your group has the same first letter of their name as you. Input Format: A string of your group members' names separated by spaces, and then a string of your name. Output Format: A string that says 'Compare notes' if you have a name buddy, or 'No such luck' if you have to work on this alone. Sample Input: Becky Joan Fred Trey Brad Sample Output: Compare notes
2 Respostas
0
this is my code
I found all of them just the Test Case #5
#include <iostream>
#include <string>
using namespace std;
int main() {
string a , b , c , d , x ;
cin >> a >> b >> c >> d ;
cout << endl ;
cin >> x ;
if ((a[0]== x[0])||(b[0] == x [0])||(c[0]== x [0])|| (d[0]== x [0]))
cout << "Compare notes";
else
cout << "No such luck";
return 0;
}
0
Are you sure about that input? I mean, are there always 4 people + you in the group?
I would recommend you using list or vector so you can add as many people as you want