标题:关于goto的编程,下面哪里出错了?要怎么改!
取消只看楼主
qq601959576
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2010-10-10
结帖率:100%
已结贴  问题点数:20 回复次数:0 
关于goto的编程,下面哪里出错了?要怎么改!
#include <iostream.h>

int main()
{
     cout<<"Do you want a random number?(Y/N)"<<endl;
     char chAnswer;
     cin>>chAnswer;
     if (chAnswer == 'N')
         goto DONE;
     else
     {
        int nRandom=rand();
        cout<<"The random number created by rand()  function is "<<nRandom<<endl;
     }
    DONE:
        cout<<"Thank you !!"<<endl;
        return 0;
}   
搜索更多相关主题的帖子: goto 
2010-10-14 09:44



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




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

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