需要帮助完成程序代码 [英] Need help completing the code of program

查看:73
本文介绍了需要帮助完成程序代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我希望你能帮助我。我有办法完成允许用户输入多个整数(如N)的程序代码,然后将它们存储在整数矩阵中,其中:


1-矩阵的维数= NXN。

2 - 矩阵的条目可以取0-2之间的任何数字。

3-第一行条目的排列是相同的条目排列第一列。

4 - 矩阵的对角线= o。

5-每行的总数= 4,也是每列的总和。


然后,程序将所有概率显示为表格。


我试着编写这段代码,但我无法完成。只是我想找到其余行的所有概率。我希望你没有心思帮助我完成它。(请看看附件)



非常感谢您的帮助


提前致谢..


恭敬地,

Miss_Lolitta



Hi all,,
I am hoping that you will help me. I have trouble how I can complete the code of program that allows the user to input a number of integers such as N, and then stores them in an integer matrix where:

1- The dimension of matrix = NXN.
2-Entries of matrix can take any number from 0-2.
3- Arrangement of entries of first row is the same arrangement of entries of first column.
4-The diagonal of matrix =o.
5- Total of every row =4,Also Total of every column.

Then, the program displays all probabilities as table.


I tried to write this code but I can''t complete it. just I want to find all probabilities for the rest of rows.I hope you don''t have mind to help me to complete that.(please,,look at attachement)


Your help would greatly be appreciated

Thanks in advance..

Respectfully,,
Miss_Lolitta

附加文件
cpp.txt (4.5 KB,309 views)
Attached Files
cpp.txt (4.5 KB, 309 views)

推荐答案

都可以除了对角线元素之外的特定行的元素具有相同的值......
can all the elements of a particular row except diagonal element have the same value......


您的问题不明确。出于某种原因,你开始谈论概率,没有先前的参考。


当我运行时,代码似乎为第一行的每个条目分配2。


你还没有说明代码应该做什么,只是一些条件。
You question is not clear. For some reason you start talking about probabilities half way through with no previous reference.

The code appeared to assign 2 to every entry on the first row when I ran it.

You haven''t actually stated what it is that the code should do, just some of the conditions.


附件中的代码不完整,因为我不知道如何满足其他条件?

更多细节:
计划理念:

1-这个程序计算绘制曲线交叉点的方法数量 points是一个由用户输入的数字,它也是矩阵的维度。


2-从点到它自己没有交集,即矩阵的对角线= o ,,但是从任何一个点到另一个点都可以找到一个以上的交叉点(0-1-2)。


****************** ******************************** **************

程序如何做?:


例如:


I-如果用户输入N = 3我们有以下矩阵


0 2 2

2 0 2

2 2 0


满足所有条件:

1-矩阵的维数= 3×3

2 - 矩阵的条目可以取0-2之间的任何数字。

3-第一行条目的排列与第一列条目的排列相同。

4 - 矩阵的对角线= o。

5-每行总数= 4,也是每列的总和。


II-如果用户输入N = 4,我们有以下矩阵,其维数为4 ×4

***************************************

0 0 2 2

0 0 2 2

2 2 0 0

2 2 0 0

****************************************

0 2 0 2

2 0 2 0

0 2 0 2

2 0 2 0

****************************************

0 1 2 1

1 0 1 2

2 1 0 1

1 2 1 0

*** *************************************

0 2 2 0

2 0 0 2

2 0 0 2

0 2 2 0

******* *********************************

0 2 1 1

2 0 1 1

1 1 0 2

1 1 2 0

*********** *****************************

0 1 1 2

1 0 2 1

1 2 0 1

2 1 1 0

*************** *************************


感谢所有人..


问候,

Lolitta
The code in attachment is not complete,because I don''t know how I can satisfied the rest of conditions?

more detail:
Idea of program:
1- this program compute how many ways can draw curves cross points" points is a number which input by user also it is the dimension of matrix".

2- From point to itself has no intersection, that is the diagonal of matrix =o ,,but from any point to another one can found more than one intersection (0-1-2).

************************************************** **************

How the program do?:

For example:

I- If user enter N=3 we have a following matrix

0 2 2
2 0 2
2 2 0

Which satisfying all conditions:
1- The dimension of matrix = 3×3
2-Entries of matrix can take any number from 0-2.
3- Arrangement of entries of first row is the same arrangement of entries of first column.
4-The diagonal of matrix =o.
5- Total of every row =4, Also Total of every column.


II- If user enter N=4 we have following matrices whose dimension is 4×4
***************************************
0 0 2 2
0 0 2 2
2 2 0 0
2 2 0 0
****************************************
0 2 0 2
2 0 2 0
0 2 0 2
2 0 2 0
****************************************
0 1 2 1
1 0 1 2
2 1 0 1
1 2 1 0
****************************************
0 2 2 0
2 0 0 2
2 0 0 2
0 2 2 0
****************************************
0 2 1 1
2 0 1 1
1 1 0 2
1 1 2 0
****************************************
0 1 1 2
1 0 2 1
1 2 0 1
2 1 1 0
****************************************

thanks for all..

regards,.
Lolitta


这篇关于需要帮助完成程序代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆