小编Mar*_*ark的帖子

循环最多运行一次(循环增量从未执行)

我在XCode 6.3.2中收到此错误:

循环最多运行一次(循环增量从未执行)

我试过for (int prob = 0; prob < response; prob++)并收到了同样的错误.

#include <iostream>
#include <cstdlib>
#include <ctime>

using namespace std;

int main()
{
    unsigned seed;
    int randa, randb, answer, correct;

    seed = static_cast<unsigned int>(time(0));
    srand(seed);

    while (true)
    {
        int response = ' ';
        cout << "How many equations would you like to do? \n";
        cin >> response;

        for (int prob = response; prob > 0; prob--)
        {
            cout << "Calculate the following equation: \n";
            correct = rand() …
Run Code Online (Sandbox Code Playgroud)

c++ for-loop

1
推荐指数
1
解决办法
4308
查看次数

标签 统计

c++ ×1

for-loop ×1