Skip to main content

All Questions

0 votes
1 answer
126 views

unexpexted output in c++ 2D array

problem i/o formats sample test case For a given two-dimensional integer array/list of size (N x M), print the array/list in a sine wave order, i.e, print the first column top to bottom, next column ...
Aryan Agrawal's user avatar
1 vote
2 answers
232 views

2d array average and total c++

it has to appear like this: #include <iostream> using namespace std; int main() { float allsales[3] [2] = {{1200.33, 2350.75}, {3677.80, 2456.05}, {750.67, 1345.99}}; float ...
lemon slayer's user avatar
-1 votes
2 answers
335 views

How to overload assignment operator and create copy constructor for 2D Dynamic Arrays?

I have a flight class which has bool** property in it. class Flight { public: int flightNumber; int row; int seat; bool** seatReserv; Flight(); Flight(int fly,int rw,int st); ~Flight(); Flight(...
saitcanbaskol's user avatar
0 votes
1 answer
42 views

How to query a dynamic 2D- array with only one pointer using new in c++

i read about 2D-Arrays and how to allocate and get the values on stackoverflow. So the proposition is to allocate only a block of memory like this: int *ary = new int[sizeX*sizeY]; and to acces it ...
whoami1996's user avatar
0 votes
1 answer
90 views

How to return a 2D array from a function in cpp

Im trying to create 2d array and want to return it tn the function... Any suggestions... I have gone through all the sites and found nothing.. double ** function() { double array[] [] ; ...
Mainuddin Shaik's user avatar
1 vote
2 answers
70 views

C++ : 2D array by reference? Why does this function work

What does the parameter printArray(int (&a)[n][m]) mean? Why are the parentheses necessary and why does only 1 value need to be provided to the printArray function? how does the function know n ...
Johnathan Rice's user avatar
0 votes
1 answer
814 views

Detect a 2d collision in C++

I need to create a function that returns a bool that is false if there is no collision between two sprites and true if there is, I was thinking for a long time and I can not find an exact solution, ...
Yamika Izumi's user avatar
0 votes
2 answers
349 views

Multidimensional array assigning in loop stating: expression must be a modifiable lvalue

So in a class, I have an array like so: public: int playGrid[10][10];//size of the grid, 10x10 or 100 squares And when I do: for (int i = iX1; i < iX2; i++) { if (...
Gamem's user avatar
  • 29
0 votes
1 answer
391 views

How can I create more than one 2D Magic Square array?

I've been working on some code that would generate a magic square which is basically a 2d array of size n x n with elements ranging from 1 to n^2 with each column, row, and diagonal summing up to a ...
Uma's user avatar
  • 33
0 votes
3 answers
2k views

Searching a 2D grid in c++

Please take a look: http://www.geeksforgeeks.org/search-a-word-in-a-2d-grid-of-characters/ This is a C++ program that searches a 2D grid for a particular word. In, the code, there are two ...
Chetan Malhotra's user avatar
1 vote
1 answer
202 views

How to print a 2D array in C++?

I am not sure how to print this 2D array. I am getting consistent errors in Visual Studio 2013. Every time I try to run it, it breaks and sometimes stops responding. If you see any other errors please ...
user avatar
1 vote
0 answers
282 views

C++ 2D Tile Engine World Loading Performance

I have a 2D platforming game much like Terraria and is based off of millions of tiles that create the world. Right now I'm trying to find an effective method at loading only the tiles that are needed. ...
Rapture686's user avatar
3 votes
2 answers
734 views

Static vector of array

I would like to have a 2D static vector that can be extended in one direction. A static vector of array sounded right to me: struct A { public: static std::vector<std::array<float, ...
Shinagan's user avatar
  • 445
0 votes
1 answer
235 views

Saving data from a 2d array into file through a function in neural network

I am newBie to neural networks. I have 2 functions. Initializing weights and saving weights. When i am initializing weights i also need to save them in a separate file. I have the following code: //...
Nabeeha Deedar's user avatar
1 vote
3 answers
4k views

Fill 2d array random ints same number

I'm trying to create a 2D array filled with random ints. The number of rows and columns are decided by the user. The issue is that when I run the program, the array is filled with the same number in ...
gainster's user avatar

15 30 50 per page