Click here to Skip to main content
15,886,110 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to get Visual C++ (2015 version) to work in "char = 8 bits" mode? Pin
Anthony Appleyard15-Aug-18 2:49
Anthony Appleyard15-Aug-18 2:49 
SuggestionRe: How to get Visual C++ (2015 version) to work in "char = 8 bits" mode? Pin
Randor 15-Aug-18 3:05
professional Randor 15-Aug-18 3:05 
GeneralRe: How to get Visual C++ (2015 version) to work in "char = 8 bits" mode? Pin
Richard MacCutchan15-Aug-18 5:18
mveRichard MacCutchan15-Aug-18 5:18 
GeneralRe: How to get Visual C++ (2015 version) to work in "char = 8 bits" mode? Pin
Anthony Appleyard15-Aug-18 5:54
Anthony Appleyard15-Aug-18 5:54 
JokeRe: How to get Visual C++ (2015 version) to work in "char = 8 bits" mode? Pin
Randor 15-Aug-18 6:21
professional Randor 15-Aug-18 6:21 
GeneralRe: How to get Visual C++ (2015 version) to work in "char = 8 bits" mode? Pin
Richard MacCutchan15-Aug-18 6:41
mveRichard MacCutchan15-Aug-18 6:41 
GeneralRe: How to get Visual C++ (2015 version) to work in "char = 8 bits" mode? Pin
Richard MacCutchan15-Aug-18 6:40
mveRichard MacCutchan15-Aug-18 6:40 
QuestionC++ Vector object question Pin
focusdoit14-Aug-18 15:12
focusdoit14-Aug-18 15:12 
Hi, I read a block of code, like:
C++
class Graph
{
public:
	int V;	// number of vertices
	vector<int> *adj;  //adjacency list

	Graph(int V);
	void addEdge(int x, int y);
	bool isRoute(int x, int y);
};

// Constructor
Graph::Graph(int V)
{
	this->V = V;
	this->adj = new vector<int>[V];
}

// add a directed edge from x to y
void Graph::addEdge(int x, int y) {
	adj[x].push_back(y);
}

int main() {

	Graph g(6);
	g.addEdge(5, 2);
	g.addEdge(5, 0);
	g.addEdge(4, 0);
	g.addEdge(4, 1);
	g.addEdge(2, 3);
	g.addEdge(3, 1);
}


I wonder the adj is a pointer that points to a Vector object, and a vector object I think it's like an one-dimensional array, but the addEdge() operation, adj[x].push_back(y),it make another array[x,y].
in Main(), the structure of the vector object, seems like:
[5,2,0]
[4,0,1]
[2,3]
[3,1]

Then this is not an one-dimensional array.so this is a Vector object, or 4 vector objects?

Thanks
AnswerRe: C++ Vector object question Pin
Richard MacCutchan14-Aug-18 20:41
mveRichard MacCutchan14-Aug-18 20:41 
AnswerRe: C++ Vector object question Pin
markkuk14-Aug-18 23:51
markkuk14-Aug-18 23:51 
GeneralRe: C++ Vector object question Pin
samzcs15-Aug-18 2:28
samzcs15-Aug-18 2:28 
GeneralRe: C++ Vector object question Pin
Richard MacCutchan15-Aug-18 2:38
mveRichard MacCutchan15-Aug-18 2:38 
GeneralRe: C++ Vector object question Pin
samzcs15-Aug-18 2:55
samzcs15-Aug-18 2:55 
GeneralRe: C++ Vector object question Pin
Richard MacCutchan15-Aug-18 4:29
mveRichard MacCutchan15-Aug-18 4:29 
GeneralRe: C++ Vector object question Pin
samzcs15-Aug-18 3:32
samzcs15-Aug-18 3:32 
GeneralRe: C++ Vector object question Pin
Richard MacCutchan15-Aug-18 4:33
mveRichard MacCutchan15-Aug-18 4:33 
GeneralRe: C++ Vector object question Pin
markkuk15-Aug-18 12:07
markkuk15-Aug-18 12:07 
GeneralRe: C++ Vector object question Pin
samzcs16-Aug-18 3:44
samzcs16-Aug-18 3:44 
QuestionRetrieve HWND of a control that has focus Pin
_Flaviu10-Aug-18 1:27
_Flaviu10-Aug-18 1:27 
QuestionRe: Retrieve HWND of a control that has focus Pin
David Crow10-Aug-18 3:45
David Crow10-Aug-18 3:45 
AnswerRe: Retrieve HWND of a control that has focus Pin
_Flaviu10-Aug-18 3:56
_Flaviu10-Aug-18 3:56 
AnswerRe: Retrieve HWND of a control that has focus Pin
_Flaviu10-Aug-18 4:36
_Flaviu10-Aug-18 4:36 
GeneralRe: Retrieve HWND of a control that has focus Pin
David Crow10-Aug-18 4:58
David Crow10-Aug-18 4:58 
AnswerRe: Retrieve HWND of a control that has focus Pin
leon de boer10-Aug-18 6:57
leon de boer10-Aug-18 6:57 
GeneralRe: Retrieve HWND of a control that has focus Pin
_Flaviu11-Aug-18 21:08
_Flaviu11-Aug-18 21:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.