下面是我想出的代码,老实说今晚是我第一次尝试编码。但是,我似乎无法让我的if
陈述正常工作。即使我输入 Westley 或 westley 或(空格)Westley,它也只是简单地跳转到 else。
我希望该程序能够接受我的任何团队成员的名字,但是我认为我的名字可以正常工作,然后我可以稍后添加其余的名字。任何想法或帮助都会很棒。另外作为旁注,如果它回到开头,我将尝试循环它,还有什么想法吗?谢谢
#include <iostream>
using namespace std;
int main ()
{
char Westley[] = "Westley";
char Alex[] = "Alex";
char Andrea[] = "Andrea";
char Bee[] = "Bee";
char Gia[] = "Gia";
char KaYeng[] = "Ka Yeng";
char Chi[] = "Chi";
char Corinne[] = "Corinne";
char Joyce[] = "Joyce";
char Parish[] = "Parish";
char membername [80];
cout << "Please Enter a Beta Team Members Name.\n";
cin >> membername;
if (membername == Westley)
{ cout << "BETA TEAM ROSTER!!\n";
cout << "Westley.\n";
cout << "Alex.\n";
cout << "Andrea.\n";
cout << "Bee.\n";
cout << "Gia.\n";
cout << "Ka Yeng.\n";
cout << "Chi.\n";
cout << "Corinne.\n";
cout << "Joyce.\n";
cout << "Parish.\n";
}
else
cout << "Not a Valid Beta Team Members Name!\n" << "Please Enter a Beta Team Members Name"<< endl;
cin >> membername;
return 0;
}