小编Ral*_*lph的帖子

如何将这些c代码行转换为c ++

我正在尝试将一些c代码导入到我的c ++程序中.有三行不直接导入:

首先:

free(t);
Run Code Online (Sandbox Code Playgroud)

第二:

new_node = (Tree *) malloc (sizeof (Tree));
Run Code Online (Sandbox Code Playgroud)

第三:

Tree * delete(int value, Tree * t)
Run Code Online (Sandbox Code Playgroud)

如何将这些更改为在C++中工作?

c c++ porting

1
推荐指数
1
解决办法
202
查看次数

Python for循环计数器错误

我正在尝试编写一个简短的代码来计算出由于每日兴趣而达到银行中给定本金所需的天数.使用我的代码在IDLE中运行时不会产生任何错误,但计数器返回0.任何想法我错过了什么?

def main():
    # irrelevant code elided by msw, Bal, Int and Tar are numeric
    counter = 0
    for i in range(0):
        if (Bal * Int) == Tar:
            print '1'
        else:
            counter + 1
    print counter
Run Code Online (Sandbox Code Playgroud)

python counter for-loop

-3
推荐指数
1
解决办法
1055
查看次数

标签 统计

c ×1

c++ ×1

counter ×1

for-loop ×1

porting ×1

python ×1