标题:新人求助(为什么这个程序最后输出的数值是0?)
只看楼主
q12170825
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2017-3-21
结帖率:0
已结贴  问题点数:20 回复次数:3 
新人求助(为什么这个程序最后输出的数值是0?)

代码如下,用的是VS2013版本,
#include <stdio.h>

int main(void)
{
    int total_pets;
    int cats;
    int dogs;
    int ponies;
    int others;


    cats = 2;
    dogs = 1;
    ponies = 1;
    others = 46;

    total_pets = cats + dogs + ponies + others;
     
    printf("we have %d pets in total total_pets");
    return 0;
搜索更多相关主题的帖子: return include others 
2017-03-21 14:58
qingdaozhang
Rank: 2
等 级:论坛游民
帖 子:6
专家分:20
注 册:2017-3-19
得分:20 
printf("we have %d pets in total total_pets",total_pets);
2017-03-21 15:01
q12170825
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2017-3-21
得分:0 
回复 2楼 qingdaozhang

添加之后 结果还是一样的
2017-03-21 15:10
q12170825
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2017-3-21
得分:0 
回复 3楼 q12170825
知道错在哪了,引号的位置万谢
2017-03-21 15:11



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-475326-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.987206 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved