Click here to Skip to main content
13,702,595 members

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
memberAnthony 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
protectorRichard 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
memberAnthony 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
protectorRichard 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
protectorRichard MacCutchan15-Aug-18 6:40 
QuestionC++ Vector object question Pin
focusdoit14-Aug-18 15:12
memberfocusdoit14-Aug-18 15:12 
Hi, I read a block of code, like:
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
protectorRichard MacCutchan14-Aug-18 20:41 
AnswerRe: C++ Vector object question Pin
markkuk14-Aug-18 23:51
membermarkkuk14-Aug-18 23:51 
GeneralRe: C++ Vector object question Pin
samzcs15-Aug-18 2:28
membersamzcs15-Aug-18 2:28 
GeneralRe: C++ Vector object question Pin
Richard MacCutchan15-Aug-18 2:38
protectorRichard MacCutchan15-Aug-18 2:38 
GeneralRe: C++ Vector object question Pin
samzcs15-Aug-18 2:55
membersamzcs15-Aug-18 2:55 
GeneralRe: C++ Vector object question Pin
Richard MacCutchan15-Aug-18 4:29
protectorRichard MacCutchan15-Aug-18 4:29 
GeneralRe: C++ Vector object question Pin
samzcs15-Aug-18 3:32
membersamzcs15-Aug-18 3:32 
GeneralRe: C++ Vector object question Pin
Richard MacCutchan15-Aug-18 4:33
protectorRichard MacCutchan15-Aug-18 4:33 
GeneralRe: C++ Vector object question Pin
markkuk15-Aug-18 12:07
membermarkkuk15-Aug-18 12:07 
GeneralRe: C++ Vector object question Pin
samzcs16-Aug-18 3:44
membersamzcs16-Aug-18 3:44 
QuestionRetrieve HWND of a control that has focus Pin
_Flaviu10-Aug-18 1:27
member_Flaviu10-Aug-18 1:27 
QuestionRe: Retrieve HWND of a control that has focus Pin
David Crow10-Aug-18 3:45
memberDavid Crow10-Aug-18 3:45 
AnswerRe: Retrieve HWND of a control that has focus Pin
_Flaviu10-Aug-18 3:56
member_Flaviu10-Aug-18 3:56 
AnswerRe: Retrieve HWND of a control that has focus Pin
_Flaviu10-Aug-18 4:36
member_Flaviu10-Aug-18 4:36 
GeneralRe: Retrieve HWND of a control that has focus Pin
David Crow10-Aug-18 4:58
memberDavid Crow10-Aug-18 4:58 
AnswerRe: Retrieve HWND of a control that has focus Pin
leon de boer10-Aug-18 6:57
memberleon de boer10-Aug-18 6:57 
GeneralRe: Retrieve HWND of a control that has focus Pin
_Flaviu11-Aug-18 21:08
member_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.


Advertise | Privacy | Cookies | Terms of Service
Web01-2016 | 2.8.180906.1 | Last Updated 19 Sep 2018
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid