gpt4 book ai didi

c++ - 我的程序一直在循环,永远不会到达 "return 0;"。是编译器不好还是代码不好?

转载 作者:塔克拉玛干 更新时间:2023-11-03 08:14:54 24 4
gpt4 key购买 nike

<分区>

我的程序一直在循环,永远不会“返回 0;”。是编译器的问题还是代码的问题?

#include<iostream>
using namespace std;

int main() {
string nameInput = "";
string Input = "Yes";
cout << "Welcome to the purple casino!" << endl << "What's your name?" << endl;
while(Input =="Yes" || "yes"){
getline(cin, nameInput);
cout << nameInput << ", what a nice name!" << endl << "Do you want to change it?" << endl;
getline(cin, Input);
if(Input =="Yes" || "yes"){
cout << "To what?" << endl;
}
}
cout << "Let's begin!";
return 0;
}

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com