0
I have the following task:
Create a TAD (struct) to represent a Circumference and then check which of the read circumferences intersect between them.
I need to store four basic data, id, x, y and ray.
I think about using std::<vector>
to store read data (indefinite amount).
I’m having difficulty in creating the TAD and how I will read the 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);
}
}
And what’s the doubt?
– Maniero
I want to know the "best way" to create the TAD and how to read in main (storing everything in <vector>).
– Misael
It seems to me a very broad question to produce a proper answer. I’m just wondering if it’s clear before it’s broad.
– Maniero
@Maniero, I managed to create a solution. I must delete the question or post the solution here?
– Misael