0

How to use 2D array to write a coordinate?(the x-,y-coodinate between 1 and 10 and no need grid)

21st Oct 2019, 9:55 AM
Carol
Carol - avatar
3 Answers
+ 4
What did the hyphen '-' mean when you wrote x-, y- coordinate? and also what did you mean by "no need grid". Share your attempt as code link within Description section above so people can see the situation clearly and offer effective suggestions.
21st Oct 2019, 10:36 AM
Ipang
+ 2
Carol This is what I have in mind, perhaps you can expand from this. #include <iostream> int main() { int coordinates[3][2] {{1,2},{3,4},{5,6}}; // Loop for 3 rows for(std::size_t r {0}; r < 3; r++) { // Loop for 2 columns on each row for(std::size_t c {0}; c < 2; c++) std::cout << coordinates[r][c] << " "; std::cout << "\n"; } return 0; }
21st Oct 2019, 11:26 AM
Ipang
0
just like this: 1 2 3 4 5 1 2 3 4 5 And i want to put some points on the coordinate, so i think i need use 2D array
21st Oct 2019, 11:04 AM
Carol
Carol - avatar