Witam mam dynamiczną tablice i chce poukładać jej indeks ale mam problem z wpisaniem wskaźnika ze struktury do zmiennej int.
#include <iostream>
struct points {
char * letter = new char;
int *A = new int;
int *B = new int;
~points() {
delete letter;
delete A;
delete B;
}
};
void comparison (points &tabPoints , int size , points &tabSecondary);
int main()
{
int step = 0;
int howManyPoints = 0;
int index = 0;
std::cin >> step >> howManyPoints;
int sizeTab = howManyPoints;
points * tabPoints = new points [howManyPoints];
points * tabSecondary = new points [2];
points * tabSort = new points [howManyPoints];
while (step != 0) {
while (howManyPoints != 0) {
std::cin >> *tabPoints[index].letter >> *tabPoints[index].A >> *tabPoints[index].B;
++index;
--howManyPoints;
}
--step;
}
// tabPoints[0].A = tabPoints[1].B;
for (int i = 0 ; i < sizeTab ; ++i) {
std::cout << *tabPoints[i].letter << " " << *tabPoints[i].A << " " << *tabPoints[i].B << std::endl;
}
tabPoints->~points();
delete [] tabPoints;
return 0;
}
void comparison (points &tabPoints , int size , points &tabSecondary) {
int max = *tabPoints[0].letter;
for (int i = 0 ; i < size ; ++i) {
}
}
chodzi mi o linijkę:
int max = *tabPoints[0].A;