Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create 易宇辰239500334.md #64

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

yyc3333
Copy link

@yyc3333 yyc3333 commented Sep 28, 2024

(1)
#include
using namespace std;

int main() {
int num1, num2;
int operation;
int result;
cout << "请输入第一个整数: ";
cin >> num1;
cout << "请输入第二个整数: ";
cin >> num2;
cout << "请选择操作 (1 表示加法, 2 表示减法): ";
cin >> operation;
if (operation == 1) {
result = num1 + num2;
cout << "结果: " << num1 << " + " << num2 << " = " << result << endl;
} else if (operation == 2) {
result = num1 - num2;
cout << "结果: " << num1 << " - " << num2 << " = " << result << endl;
} else {
cout << "无效的操作选择,请输入 1 或 2。" << endl;
}
return 0;
}

(2)
#include
using namespace std;
int main() {
int number;
cout << "请输入一个整数: ";
cin >> number;
if (number % 2 == 0) {
cout << number << " 是偶数。" << endl;
} else {
cout << number << " 是奇数。" << endl;
}
return 0;
}

(3)
#include
#include // 包含 rand() 和 srand() 函数
#include // 包含 time() 函数
using namespace std;
int main() {
srand(time(0));
int target_number = rand() % 10 + 1;
int guess_count = 0;
int guess;
cout << "欢迎来到猜数字游戏!" << endl;
cout << "我已经想好了一个 1 到 10 之间的数字。" << endl;
while (true) {
cout << "请输入你的猜测: ";
cin >> guess;
guess_count++;
if (guess < target_number) {
cout << "猜小了!" << endl;
} else if (guess > target_number) {
cout << "猜大了!" << endl;
} else {
cout << "恭喜你,猜对了!你总共猜了 " << guess_count << " 次。" << endl;
break;
}
}
return 0;
}

Copy link

sourcery-ai bot commented Sep 28, 2024

🧙 Sourcery has finished reviewing your pull request!


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @yyc3333 - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant