gpt4 book ai didi

c++ - 我的回文程序出现异常?

转载 作者:太空宇宙 更新时间:2023-11-04 08:37:10 25 4
gpt4 key购买 nike

<分区>

我正在尝试在我的程序下运行,该程序用于 Palindrome,但它给了我一个异常错误,请帮忙?我正在使用 Visual Studio 2013

#include<iostream>

int main(){
char a[100], b[100];

std::cout << "This is a program to check palindrome or not." << std::endl;
std::cout << "Enter your string:\n" << std::endl;
gets(a);

/*Here string does copy..*/
strcpy(a, b);

/*Here string does reverse..*/
strrev(b);

/*Here string does compare*/
if (strcmp(a, b) == 0){
std::cout << "Congrats, It's palindrome!" << std::endl;
}
else{
std::cout << "Sorry BOSS but this is not a palindrome." << std::endl;
}
return 0;
}

帮助将不胜感激!

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