c++算法,对我是难事,对你可能很容易

sowhat123456 2009-06-08 02:53:57
各位大侠,如下是一个c++的算法,对于已经毕业了几年不再编程的我来说,确实是件难事。请大侠帮个忙,应该几分钟就可以解决吧,先谢过!

Write a full program in C++ that creates the two-dimensional randomArray array with 10 rows and 10 columns, and fills it with random numbers respectively: the first row with random number in range [1, 100), the second row with random number in range [100, 200), …, the 10th row with random number in range [900, 1000), The program then displays the array elements on-screen 10 in each row.
...全文
36 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
海枫 2009-06-09
  • 打赏
  • 举报
回复
Write a full program in C++ that creates the two-dimensional randomArray array with 10 rows and 10 columns, and fills it with random numbers respectively: the first row with random number in range [1, 100), the second row with random number in range [100, 200), …, the 10th row with random number in range [900, 1000), The program then displays the array elements on-screen 10 in each row.

编写完整的C++程序来创建一个10行10列的二维数组randomArray,分别使用下述的随机数填充数组:使用随机数范围[1,100)填充第一行,[100,200)填充第二行,……[900, 1000)填充第十行,并在屏幕上显示所有数组元素,每行10个。
koulongfei 2009-06-09
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 sowhat123456 的回复:]

简单翻译如下:

创建二维randomArray阵列10行和10列,并填补与随机编号分别为:第一行中的随机数范围[ 1 , 100 ) ,第二行中的随机数范围[ 100 , 200 ) , ... ,第10行随机数字的范围[ 900 , 1000 ) ,该程序在屏幕上的显示数组元素为每一行10个。
[/Quote]

这个我也会做的,只可惜不习惯看着英语做题,看来得学习英语,适应时势了.
pathuang68 见过好多次,英语,好.
sowhat123456 2009-06-08
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 pathuang68 的回复:]
看看这个:

C/C++ code
#include <iostream>
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
using namespace std;

int main(void)
{
int a[10][10] = {0};
srand(time(NULL));
for(int i = 0; i < 10; i++)
{
for(int j = 0; j < 10; j++)
{
a[i][j] = rand()%100 + i * 100;
cout << a[i][j] << "\t";
}
cout <…
[/Quote]

非常感谢 pathuang68 的帮忙!!!谢谢!
aaaa3105563 2009-06-08
  • 打赏
  • 举报
回复
英文·· 有点小困难
sowhat123456 2009-06-08
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 koulongfei 的回复:]
是英文的,看着累啊.谁帮忙翻译哈.
[/Quote]

简单翻译如下:

创建二维randomArray阵列10行和10列,并填补与随机编号分别为:第一行中的随机数范围[ 1 , 100 ) ,第二行中的随机数范围[ 100 , 200 ) , ... ,第10行随机数字的范围[ 900 , 1000 ) ,该程序在屏幕上的显示数组元素为每一行10个。
koulongfei 2009-06-08
  • 打赏
  • 举报
回复
是英文的,看着累啊.谁帮忙翻译哈.
pathuang68 2009-06-08
  • 打赏
  • 举报
回复
4楼代码说明:
上面的代码在VC6上通过,类似的输出结果如下:

79 64 25 40 70 98 28 74 55 62
140 159 167 127 111 111 143 199 175 120
264 275 207 200 285 219 254 223 205 208
329 304 354 374 386 374 321 352 368 362
459 429 453 484 419 442 458 463 453 450
522 513 554 525 521 514 501 528 518 535
642 667 623 607 677 695 632 633 688 651
702 708 753 710 714 726 798 703 733 723
858 896 809 826 825 823 801 805 826 882
945 914 904 996 921 980 950 905 923 927
pathuang68 2009-06-08
  • 打赏
  • 举报
回复
看看这个:

#include <iostream>
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
using namespace std;

int main(void)
{
int a[10][10] = {0};
srand(time(NULL));
for(int i = 0; i < 10; i++)
{
for(int j = 0; j < 10; j++)
{
a[i][j] = rand()%100 + i * 100;
cout << a[i][j] << "\t";
}
cout << endl;
}
return 0;
}
lylm 2009-06-08
  • 打赏
  • 举报
回复
for循环
rand取随机数
sowhat123456 2009-06-08
  • 打赏
  • 举报
回复
哥们,有心了,谢谢!
jhony_lee 2009-06-08
  • 打赏
  • 举报
回复
看不懂英文,帮顶!

65,211

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧