Tag Archives: C++

Time measuring by miliseconds in UNIX – C++

If you want to measure time in miliseconds in Unix, you can use this code. This program returns 2 miliseconds as a result related with usleep function with value of 2000. You can replace your function which you want to measure runtime with this usleep function.
Click to read more…

Tagged , ,

Dynamic Two Dimensional Array (Matrix) – C++

// two dimensional dynamic array (matrix) in C++
	int row,col;      //no of rows and columns
	int** array;     //dynamic array
	cin>>row>>col;     //read no of rows and columns from user

//memory allocation
	array = new int* [row];
	for (int i = 0; i < row; i++)
		array[i] = new int[col];

//then initialize array
	for(int i=0;i<row;++i)
		for(int j=0;j<col;++j)