测评会员优惠活动进行中 · 开通 VIP,有效期内测评不限次 VIP 优惠中 · 测评不限次 立即查看

A66742. 执行下面C++代码后,输出的结果不可能是89781。( )1 #include <iostream>

判断题

题目描述

执行下面C++代码后,输出的结果不可能是89781。( )

1 #include <iostream>
2 #include <cstdlib> // 为了使用 rand() 和 srand()
3 #include <ctime> // 为了使用 time()
4
5 using namespace std;
6
7 int main() {
8  // 设置随机种子
9  srand(time(NULL));
10
11  int i = 1;
12  int s[5];
13  while(i <= 5)
14  {
15   int a = rand() % 10;
16   if(a % 3 == (i + 1) % 3)
17    s[i++] = a;
18  }
19  for(int i = 1; i <= 5; i++)
20   cout << s[i];
21  cout << endl;
22  return 0;
23 }

选项(单选)