0); { cout(0); { cout,c++,while-loop,C++,While Loop" /> 0); { cout(0); { cout,c++,while-loop,C++,While Loop" />

为什么是C++;代码不工作(简单) 我基本上已经开始学习C++。我以前在Python3.6上编写过代码,所以我对这种结构有点不熟悉。事先很抱歉问了这么简单的问题。问题是:没有任何输出。所需输出:代码中显示的4个句子。我做错了什么 #include <iostream> using namespace std; void mice(int); void run(int); int main() { mice(2); run(2); return 0; } void mice(int n) { while (n > 0); { cout << "Three blind mice"; n --; } } void run(int n) { while (n > 0); { cout << "See how they run"; n --; } } #包括 使用名称空间std; 空白小鼠(int); 无效运行(int); int main() { 小鼠(2只); 运行(2); 返回0; } 无效鼠标(int n) { 而(n>0); { cout(0); { cout

为什么是C++;代码不工作(简单) 我基本上已经开始学习C++。我以前在Python3.6上编写过代码,所以我对这种结构有点不熟悉。事先很抱歉问了这么简单的问题。问题是:没有任何输出。所需输出:代码中显示的4个句子。我做错了什么 #include <iostream> using namespace std; void mice(int); void run(int); int main() { mice(2); run(2); return 0; } void mice(int n) { while (n > 0); { cout << "Three blind mice"; n --; } } void run(int n) { while (n > 0); { cout << "See how they run"; n --; } } #包括 使用名称空间std; 空白小鼠(int); 无效运行(int); int main() { 小鼠(2只); 运行(2); 返回0; } 无效鼠标(int n) { 而(n>0); { cout(0); { cout,c++,while-loop,C++,While Loop,while(n>0);导致无休止的循环。它应该是while(n>0) 相关帖子:在带有while的行上…linewhile(n>0);语句的;完成了语句,因此它位于while循环中,但n从未更改 如果删除;,则将执行{}之间的循环体 e、 g void鼠标(int n) { 而(n>0) { 不能尝试在whiler之后删除;删除;after while。while(n>0);是一个带有空正文的循环(由于结尾有分号),并且由于n没有改变-这也是一个无限循环。请再次尝试,并集中精力访问页面。我的编译

while(n>0);
导致无休止的循环。它应该是
while(n>0)


相关帖子:

在带有while的行上…line
while(n>0);
语句的
完成了语句,因此它位于while循环中,但
n
从未更改

如果删除
,则将执行
{}
之间的循环体

e、 g

void鼠标(int n)
{
而(n>0)
{

不能尝试在whiler之后删除
删除;after while。
while(n>0);
是一个带有空正文的循环(由于结尾有分号),并且由于
n
没有改变-这也是一个无限循环。请再次尝试,并集中精力访问页面。我的编译器会给出警告并指向分号。如果没有,您可能希望提高警告级别。根据您使用的内容,使用
/W4
-pedantic
void mice(int n)
{
    while (n > 0)
    {
        cout << "Three blind mice";
        n --;
    }
}