Ok so i have a group of numbers in a vector container and i want to pair them this way...eg; if these are my numbers ( 23, 25, 35, 34,75) i want to pair them this way...
(23, 25) (23,35) (23,34) (23,75) (25,35) (25,34) (25,75) (35,34) (35,75) (34,75)
such that every number is paired with any other number in the group...once.
since the quantity of numbers in the vector container may change i used a dynamic list...
I have written my code for it but for some reason is not working properly. Am gonna paste my code here..so that the experts on the forum can help me out. thanks in advance.
So am just going to post the part of the code related to my problem...i dont think is a good idea copying the whole thing and pasting it here..is a long one...to make things easier for you guys who are gonna help me out..
vector cross_check was created and is filled up somewhere in the original code... thanks
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
struct dropping_pairs {
int x;
int y;
dropping_pairs * next;
};
void dropping_pairing (dropping_pairs * & testa, int & i, int & j);
void display_pairs ( dropping_pairs * & testa);
int main (){
int k = 0, j;
if (k < cross_check.size ()- 1)
{for( j = k+1; j< cross_check.size(); j++){
dropping_pairing(start_of_drops, k, j);}
k +=1;
}
display_pairs(start_of_drops);
return 0;
}
JLBorges but anyway can you please tell me why my code didn't work? yours is working fine..thank you but i will like to know why mine didn't work can you shed some light??? thank you