无法将输出随机化

时间:2018-09-17 16:23:50

标签: c++

我想知道是否有代码可以将c ++中的输出随机化。

我已经尝试过:

#include <iostream>
#include <cstdlib>

using namespace std;

int main()
{
    switch(rand() %3)
    {
    case 0:
        cout << "Phrase 1" << endl;
        break;
    case 1:
        cout << "Phrase 2" << endl;
        break;
    case 3:
        cout << "Phrase 3" << endl;
        break;
    default:
        break;
    }
}

但似乎什么也没输出。

0 个答案:

没有答案
相关问题