Coordination System in console

Hi,
I am relatively new to programming.
I want to give out a simple Coordinstion system
on the console with one Point in it.
So i would ask the user to give me an x and y point
And put that in to the coordination system.
My Problem is i dont know how to make a coprdination system.
Do i have to use a nested vector ?
If i do that wont be all the "empty" spaces 0, so i would have a coordination system full of 0's and then an x on the point. Is there a way to do that
with out the 0's so the rest of the coordination system should just be empty.


Thx for your help

What is a coordination system?
It's one of those feedback systems that help keep something balanced, like the inverted pendulum on a cart :)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <iostream>
#include <vector>

struct Coordinste {
    int x;
    int y;
};

int main()
{
    std::vector<Coordinste> coordinates;
    {    
        std::cout << "enter x y point: ";
        int x;
        int y;
        std::cin >> x >> y;
        coordinates.push_back({x, y});
    }

    // you now have one coordinate (x, y) point stored.
    // The rest of it doesn't exist, therefore is empty.
}
Last edited on
Topic archived. No new replies allowed.