I have the following task:
Create a TAD (struct) to represent a Circumference and then check which of the read circles have intersections between them.
I need to store four basic data, id, x, y, and radius .
I think of using std::<vector>
to store the read data (undefined amount).
I'm having difficulty creating TAD and how I'll read on main
// lib.hpp
#include <vector.h>
typedef struct{
double id, x, y, raio;
} Circunferencia;
// TAD
struct circVector{
Circunferencia *circ;
// como seria a passagem por parametro aqui?
int calcularIntersecao(vector<Circunferencia> circ);
};
----------------
// main.cpp
#include<iostream>
#include<vector>
#include "lib.hpp"
int main(){
int n;
// cria um "vetor de structs"
vector<Circunferencia> c;
// auxilia a leitura antes de guardar na TAD
Circunferencia aux;
while(cin >> n){
cin >> aux._id;
cin >> aux._x;
cin >> aux._y;
cin >> aux._raio;
// adiciona a struct q foi lida para o vector de structs
c.push_back(aux);
}
}