Difficulties debugging

Hello there, there's not much to say, but Im having trouble debugging the program.
When I check the error page it gives nothing, but when i try to debug the black window opens, but nothing is shown there, not even the cursor.
Any suggestion?
Thank you in advance
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
  #include "stdafx.h"
#include <iostream>
#include <math.h>
#include <time.h>
#include<iomanip>
#include<array>
#include <algorithm>

using namespace std;
const int AS = 5;
void FillingRandomly(int [AS][AS]);
void printing(int[AS][AS]);
void forsorting(int[][AS], int);
int c,temp,x;

int main()

{
	int funny = 0;
	int timpa = 0;
	int counter = 0;
	int Array[AS][AS];
	srand(time(0));


	FillingRandomly(Array);
	

	cout << "The unsorted array is" << endl << endl;

	printing(Array);


	cout << "The sorted array is" << endl << endl;



	forsorting(Array, funny);

		

	
	
	system("PAUSE");


	return 0;

}

void FillingRandomly(int Array[AS][AS])
{for (int i = 0; i<AS; i++)
	{
		for (int j = 0; j<AS; j++)
			Array[i][j] = rand()%87 +12;
	
}
}

void printing(int Array[AS][AS])
{
	int counter = 0;
	for (int i = 0; i<AS; i++)
	{
		for (int j = 0; j<AS; j++)
		{
			cout << setw(5) << Array[i][j];
			counter++;
			if (counter%AS == 0)
				cout << endl << endl;
		}
	}
}

void forsorting(int Array[AS][AS], int funny)
{

    int w=0;
	int dice = 0;
	int Brray[AS*AS];
	int timpa = 0;
	int super = 0;
	int sink;
	int check;
	int space=0;
	int k;
	
	

	//Transofrming Array[][] into Brray[]
	for (int i = 0; i < AS; i++)
	{
		for (int k = 0; k < AS; k++)
		{
			Brray[space] = Array[i][k];
			space++;
		}
	}


	//Bubble sorting in Brray[]

	for (int passer = 1; passer <= AS-1; passer++)
	{
		for (int timon = 1; timon <= AS-1; timon++)
		{
			if (Brray[timpa]>Brray[timpa + 1])
			{
				super = Brray[timpa];
				Brray[timpa] = Brray[timpa + 1];
				Brray[timpa + 1] = super;
			}
		}
	}

	k=0;
	for(int col=0;col<AS; col++)
		for(int row=0;row<=col;row++)
			Array[row][col-row]=Brray[k++];

	for(c=AS-1;c>-AS;c++)
	{temp=AS-abs(c)-1;
	x=temp;
	while (x>=0)
	{if(c>=0)
	{cout<<Array[x][temp-x]<<", ";
	}
	else
	{cout<<Array[AS-(temp-x)-1][(AS-1)-x]<<", ";
	}
	--x;
	}
	cout<<endl;
	}
	
}
//It works now but the printing out isnt 100% correct. Im not going to correct all of my homework, just so I can get the grade I deserve 
Have you set a breakpoint?
"black window" sounds like its the terminal opening.

You can set breakpoint using the F9 key (usually) in Visual Studio.
Just tried it, nothing changed
Im not going to correct all of my homework, just so I can get the grade I deserve
Yes, that's the right attitude:D

The loop starting on line 103: timpa will not be increased

line 121: Due to this c=AS-1;c>-AS;c++ your loop will take a while... (and will crash)
After a quick look, I have 2 quick comments:

In line 121
for(c=AS-1;c>-AS;c++)
c is incrementing, so the loop will never terminate.

In the block from line 103 to 114 timpa is never modified, are you sure you didn't mean to use timon instead?
Topic archived. No new replies allowed.