小编Mga*_*rlo的帖子

虽然功能不像我想要的那样工作

有一个与while函数有关的新问题.听起来很简单,我仍然无法绕过它.

就像我上一个程序一样,这个程序在正确和错误的消息之后意外关闭.我希望在输入数字后循环,这样程序就不会停止.感谢您的帮助,如果有的话.

#include <iostream>
using namespace std;

int main()
{
    int X = 0; //setting the first variable
    int num; //setting the second

    while (X == 0) //this should happen whenever X is equal to 0
    {
          cout << "Type a number bigger than 3. "; //output
          X++; //This should increase X, so that the next while function can happen
    }
    while (X == 1) //again, since I increased x by one, (0+1=1 obviously) this should happen
    {
          cin >> …
Run Code Online (Sandbox Code Playgroud)

c++ while-loop

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

标签 统计

c++ ×1

while-loop ×1