C++语言,用的vscode,代码如下
```c++
#include<iostream>
#include<string>
#include <stdio.h>
#include <cstring>
using namespace std;
int main()
{
short intend;
string first_name, last_name;
cout << "Please enter your first name AND last name:" << endl;
cin >> first_name
>> last_name;
cout << "hello,"
<< last_name << first_name
<< " Do you want to play some number series puzzles?(0/1)" << endl;
cin >> intend;
if (intend == 0) //未完成部分
{
int intend2;
cout << "Ok, So would you want to play some word games?(0/1)\n";
cin >> intend2;
if (intend2 == 1)
{
char *word;
const char *trueword = "twelve plus one";
cout << "Re-construct the sentence with 'eleven plus two'." << endl;
cin >> word;
if (strcmp(word, trueword) == 0)
{
cout << "You're right!" << endl;
}
if (strcmp(word, trueword) != 0)
{
cout << "false\n";
}
}
}
else if (intend == 1)
{
int num1;
cout << "1, 1, 2, 3,() ,8, ...What is the next num\n";
cin >> num1;
if (num1 == 5)
{
cout << "You're right!" << endl;
}
else if (num1 != 5)
{
cout << "Doesn't seem right..." << endl;
}
}
else
{
cout << "1=YES, 0=NO, You can try again." << endl;
return 0;
}
cout << " and goodbye!\n";
system("pause");
return 0;
}
具体问题:
在未完成部分if (strcmp(word, trueword) == 0)
输入twelve past one(正确答案)后,卡顿约2秒,退出程序。
各位来帮忙看看吧