标题:TC2.0 代码运行小问题
只看楼主
黑色洋葱
Rank: 2
等 级:论坛游民
帖 子:13
专家分:11
注 册:2014-2-14
结帖率:100%
已结贴  问题点数:20 回复次数:2 
TC2.0 代码运行小问题
TC2.0中
一个已知高度通过输入长和宽来计算长方体体积的代码  
为什么ctrl+F9(运行)之后输入了长和宽之后页面消失  在第二次运行后才会输出结果呢?
#include<stdio.h>                                    
#define Height 10

int calculate(int Long,int Width);

int main()
{
     int m_Long;
     int m_Width;
     int result;

     printf("The height of the rectangle is: %d\n",Height);

     printf("Please enter the length of the rectangle\n");
     scanf("%d",&m_Long);

     printf("Please enter the width of the rectangle\n");
     scanf("%d",&m_Width);

     result=calculate(m_Long,m_Width);
     printf("The volumeof the rectangle is:");
     printf("%d\n",result);
     return 0;
}

int calculate(int Long,int Width)
{
     int result=Long*Width*Height;
     return result;
}

搜索更多相关主题的帖子: include result 长方体 
2014-02-21 15:57
wp231957
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:神界
等 级:版主
威 望:422
帖 子:13681
专家分:53296
注 册:2012-10-18
得分:20 
看错   不好意思

[ 本帖最后由 wp231957 于 2014-2-21 16:10 编辑 ]

DO IT YOURSELF !
2014-02-21 16:09
黑色洋葱
Rank: 2
等 级:论坛游民
帖 子:13
专家分:11
注 册:2014-2-14
得分:0 
在最后加system(“pause”);
我明白了
2014-02-22 13:18



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




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

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