Click here to Skip to main content
13,765,245 members

C / C++ / MFC

 
GeneralRe: How to get Visual C++ (2015 version) to work in "char = 8 bits" mode? Pin
Anthony Appleyard15-Aug-18 3:49
memberAnthony Appleyard15-Aug-18 3:49 
SuggestionRe: How to get Visual C++ (2015 version) to work in "char = 8 bits" mode? Pin
Randor 15-Aug-18 4:05
professional Randor 15-Aug-18 4:05 
GeneralRe: How to get Visual C++ (2015 version) to work in "char = 8 bits" mode? Pin
Richard MacCutchan15-Aug-18 6:18
protectorRichard MacCutchan15-Aug-18 6:18 
GeneralRe: How to get Visual C++ (2015 version) to work in "char = 8 bits" mode? Pin
Anthony Appleyard15-Aug-18 6:54
memberAnthony Appleyard15-Aug-18 6:54 
JokeRe: How to get Visual C++ (2015 version) to work in "char = 8 bits" mode? Pin
Randor 15-Aug-18 7:21
professional Randor 15-Aug-18 7:21 
GeneralRe: How to get Visual C++ (2015 version) to work in "char = 8 bits" mode? Pin
Richard MacCutchan15-Aug-18 7:41
protectorRichard MacCutchan15-Aug-18 7:41 
GeneralRe: How to get Visual C++ (2015 version) to work in "char = 8 bits" mode? Pin
Richard MacCutchan15-Aug-18 7:40
protectorRichard MacCutchan15-Aug-18 7:40 
QuestionC++ Vector object question Pin
focusdoit14-Aug-18 16:12
memberfocusdoit14-Aug-18 16: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 21:41
protectorRichard MacCutchan14-Aug-18 21:41 
AnswerRe: C++ Vector object question Pin
markkuk15-Aug-18 0:51
membermarkkuk15-Aug-18 0:51 
GeneralRe: C++ Vector object question Pin
samzcs15-Aug-18 3:28
membersamzcs15-Aug-18 3:28 
GeneralRe: C++ Vector object question Pin
Richard MacCutchan15-Aug-18 3:38
protectorRichard MacCutchan15-Aug-18 3:38 
GeneralRe: C++ Vector object question Pin
samzcs15-Aug-18 3:55
membersamzcs15-Aug-18 3:55 
GeneralRe: C++ Vector object question Pin
Richard MacCutchan15-Aug-18 5:29
protectorRichard MacCutchan15-Aug-18 5:29 
GeneralRe: C++ Vector object question Pin
samzcs15-Aug-18 4:32
membersamzcs15-Aug-18 4:32 
GeneralRe: C++ Vector object question Pin
Richard MacCutchan15-Aug-18 5:33
protectorRichard MacCutchan15-Aug-18 5:33 
GeneralRe: C++ Vector object question Pin
markkuk15-Aug-18 13:07
membermarkkuk15-Aug-18 13:07 
GeneralRe: C++ Vector object question Pin
samzcs16-Aug-18 4:44
membersamzcs16-Aug-18 4:44 
QuestionRetrieve HWND of a control that has focus Pin
_Flaviu10-Aug-18 2:27
member_Flaviu10-Aug-18 2:27 
QuestionRe: Retrieve HWND of a control that has focus Pin
David Crow10-Aug-18 4:45
memberDavid Crow10-Aug-18 4:45 
AnswerRe: Retrieve HWND of a control that has focus Pin
_Flaviu10-Aug-18 4:56
member_Flaviu10-Aug-18 4:56 
AnswerRe: Retrieve HWND of a control that has focus Pin
_Flaviu10-Aug-18 5:36
member_Flaviu10-Aug-18 5:36 
GeneralRe: Retrieve HWND of a control that has focus Pin
David Crow10-Aug-18 5:58
memberDavid Crow10-Aug-18 5:58 
AnswerRe: Retrieve HWND of a control that has focus Pin
leon de boer10-Aug-18 7:57
memberleon de boer10-Aug-18 7:57 
GeneralRe: Retrieve HWND of a control that has focus Pin
_Flaviu11-Aug-18 22:08
member_Flaviu11-Aug-18 22: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
Web05-2016 | 2.8.181114.1 | Last Updated 14 Nov 2018
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid