gpt4 book ai didi

c - 如何删除这个重复的 else 语句?

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

伪代码如下:

if A
then B
if C
then D
else
then E
else
then E

B、D、E 包括几行。我们可以看到这里的“else”重复了两次。如何去除重复代码并保持功能?不要使用“goto”。

最佳答案

只是让它们成为一个函数。即

void E() {

... Your several lines of code here

}

关于c - 如何删除这个重复的 else 语句?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18627064/

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