بازديد : 185 مرتبه
تاريخ : جمعه 16 دی 1390
برنامه ای که یک مجموعه را از کاربر دریافت کرده و ماتریس رابطه را نمایش می دهد. سپس خاصیت هم ارزی را روی آن بررسی می کند. ![]()
a = Val(InputBox(
" !", "A")) Dim c(a - 1) As String Dim i As Integer For i = 0 To a - 1c(i) = InputBox(
"" & i + 1, "A") Next Dim n(a - 1, a - 1) As String For i = 0 To a - 1 For j = 0 To a - 1 Dim k As Integerk = MsgBox(
"" & "(" & c(i) & "," & c(j) & ")" & " ", MsgBoxStyle.OkCancel, "A") If k = 1 Then n(i, j) = 1 If k = 2 Then n(i, j) = 0 Next Next For i = 0 To a - 1Label1.Text = Label1.Text + vbNewLine
For j = 0 To a - 1Label1.Text = Label1.Text + n(i, j) +
" " Next Next Dim f As Integer Dim p As Boolean For i = 0 To a - 1 For j = 0 To a - 1 If i = j Then If n(i, j) = 1 Then f = f + 1 End If Next Next For i = 0 To a - 1 For j = 0 To a - 1 If (i <> j) Then If n(i, j) = n(j, i) Thenp =
True Elsep =
False End If If p = False Then GoTo L2 End If Next NextL2:
Dim m(a - 1, a - 1) As String Dim w As Integerw = 0
Dim q As Integerq = 0
For i = 0 To a - 1 For j = 0 To a - 1w = 0
For q = 0 To a - 1m(i, j) = Val(n(i, q)) * Val(n(q, w))
If m(i, j) = 1 Then GoTo L1 NextL1: w = w + 1
Next Next Dim t, r As Integert = 0
r = 0
For i = 0 To a - 1 For j = 0 To a - 1 If m(i, j) = 1 Then t = t + 1 If n(i, j) = 1 Then r = r + 1 Next NextLabel6.Visible =
True If f = a ThenLabel2.Text =
" " ElseLabel2.Text =
" " End If If p = True ThenLabel3.Text =
" " ElseLabel3.Text =
" " End If If (t <= r) ThenLabel4.Text =
" " ElseIf (t > r) ThenLabel4.Text =
" " End If If ((f = a) And (p = True) And (t <= r)) ThenMsgBox(
" ", , "A ") ElseMsgBox(
" ", , "A ") End If End Sub




بازديد : 203 مرتبه
تاريخ : جمعه 16 دی 1390
#include
#include
int fact(int);
int main()
{
int m;
cout<<"\n Enter a number:";
cin>>m;
cout<<"\n Number="<
آخرين مطالب
