21xrx.com
2024-03-29 17:32:53 Friday
登录
文章检索 我的文章 写文章
生成随机数的C++程序
2021-07-08 15:27:03 深夜i     --     --
C + +

用于打印随机数的 C++ 程序。

C++编程代码

#include <iostream>
#include <cstdlib>


using namespace std;

int main ()
{
  int n, t, c;

  cout << "Enter the number of random numbers you want" << endl;
  cin >> n;

  cout << "Random numbers are:" << endl;

  for (c = 1; c <= n; c++)
  {
    t = random();
    cout << t << endl;
  }

  return 0;
}

 

  
  
下一篇: C++类示例程序

评论区

{{item['qq_nickname']}}
()
回复
回复