Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void ToVec(int[,] mat)
- {
- int i,j;
- int[] vec = new int[mat.GetLength(0) * mat.GetLength(0)];
- int counter = 0;
- for ( i = 0; i < mat.GetLength(0); i++)
- {
- for ( j = 0; j < mat.GetLength(0); j++)
- {
- vec[counter] = mat[i, j];
- counter++;
- }
- }
- int degel = 1, mone = 0, c = 0;
- while (c < vec.Length)
- {
- degel = 1;
- for (i = 0; i < vec.Length; i++)
- {
- if ((vec[c] == vec[i])&&(c!=i))
- degel = 0;
- }
- if (degel == 1)
- {
- mone++;
- }
- c++;
- }
- int[] vec2 = new int[mone];
- c = 0;
- counter=0;
- while (c < vec.Length)
- {
- degel = 1;
- for (i = 0; i < vec.Length; i++)
- {
- if ((vec[c] == vec[i]) && (c != i))
- degel = 0;
- }
- if (degel == 1)
- {
- vec2[counter] = vec[c];
- counter++;
- }
- c++;
- }
- for ( i = 0; i < vec2.Length; i++)
- {
- Console.Write(vec2[i] + " ");
- }
- }
Add Comment
Please, Sign In to add comment