I have 9 decimal numbers in A3, i need to output them 3 at a time and I'm not sure how.

EX) A3 holds '14 8 6 8 5 4 6 4 4'
[INDENT]It should display[/INDENT]
14 8 6
8 5 4
6 4 4

Here's everything, it works now but something is wrong with the output. Binary is not workin. Gonna mark as solved (if i can figure out how)
[CODE]#include <iostream>

include <fstream>
include <vector>
include <string>
include <sstream>

using namespace std;

class ConvertDecimal {
public:
ConvertDecimal();
void print();

private:
int MAX_SIZE;
void Convert ();
string decToBinary (int decimal);
string decToHex (int decimal);
string decToBCD (int decimal);
char hex(int num);
string BCD(char num);
vector <int> decNumbers;
vector<string> HexNumbers;
vector<string> BCDNumbers;
vector<string> BinaryNumbers;
};

ConvertDecimal::ConvertDecimal() {
MAX_SIZE = 256;

decNumbers.resize(MAX_SIZE);
HexNumbers.resize(MAX_SIZE);
BCDNumbers.resize(MAX_SIZE);
BinaryNumbers.resize(MAX_SIZE);

for (int i = 0; i < MAX_SIZE; i++) {
    decNumbers[i] = i;
    //cout << decNumbers[i] << " ";
}

Convert();

}

void ConvertDecimal::Convert () {
for (int i = 0; i < MAX_SIZE; i++) {
BinaryNumbers[i] = decToBinary(i);
BCDNumbers[i] = decToBCD(i);
HexNumbers[i] = decToHex(i);
}
}
string ConvertDecimal::decToBinary(int decimal) {
int quotient = 1;
int temp = decimal;
string remainder;
string binaryNum = "2";

while (quotient!=0) {
    remainder = temp%2;
    quotient = temp/2;
    temp = quotient;
    binaryNum = binaryNum + remainder;
}
binaryNum.erase(0);
//cout << binaryNum;
return binaryNum;

}
char ConvertDecimal::hex(int num) {
if (num==10) { return 'A'; }
else if (num==11) { return 'B';}
else if (num==12) { return 'C';}
else if (num==13) { return 'D';}
else if (num==14) { return 'E';}
else return 'F';
}
string ConvertDecimal::decToHex(int decimal) {
string hex;
int num,y,i;
int n=1;
int * r;
char h[16]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};

y = num = decimal;
while(num >= 16)
{
    num/=16;
    ++n;
}
r=new int[n];
for(i=0 ; y >= ...

Gonna try that once I get home, browsing from my phone at work right now. Thanks for the tips!

I'm writing a program to convert Decimal numbers to binary, hexadecimal, and BCD as a refresher before i start getting code assignments in school. I'm almost done, but i have a seg_fault (compiler says decToHex function) in 1 function and i am hoping for some feedback on the others.
I'll break it up a little so it's not 1 giant block of code and attach the .CPP

[B]Class Definition[/B]
[CODE]
class ConvertDecimal {
public:
ConvertDecimal();
//void print();

private:
int MAX_SIZE;
void Convert ();
string decToBinary (int decimal);
string decToHex (int decimal);
string decToBCD (int decimal);
char hex(int num);
string BCD(char num);
vector <int> decNumbers;
vector<string> HexNumbers;
vector<string> BCDNumbers;
vector<string> BinaryNumbers;
};
[/CODE]

[B]Initialize and Convert functions[/B]
[CODE]ConvertDecimal::ConvertDecimal() { //Initialize decNumbers array
MAX_SIZE = 256;

decNumbers.resize(MAX_SIZE);
HexNumbers.resize(MAX_SIZE);
BCDNumbers.resize(MAX_SIZE);
BinaryNumbers.resize(MAX_SIZE);

for (int i = 0; i < MAX_SIZE; i++) {
    decNumbers[i] = i;
    //cout << decNumbers[i] << " ";
}

Convert();

}

void ConvertDecimal::Convert () {
for (int i = 0; i < MAX_SIZE; i++) {
BinaryNumbers[i] = decToBinary(i);
//decToBCD(i);
decToHex(i);
}
}[/CODE]

[B]decToBinary[/B]
[CODE]int quotient = 1;
int temp = decimal;
string remainder;
string binaryNum = "2";

while (quotient!=0) {
    remainder = temp%2;
    quotient = temp/2;
    temp = quotient;
    binaryNum = binaryNum + remainder;
}
binaryNum.erase(0);
cout << binaryNum;
return binaryNum;

}[/CODE]

[B]hex and decToHex[/B]
[CODE]char ConvertDecimal::hex(int num) {
if (num==10) { return 'A'; }
else if (num==11) { return 'B';}
else if (num==12) { return 'C';}
else if (num==13) { return 'D';}
else if (num==14) { return 'E';}
else return ...

I got it working, but i still don't know exactly what the problem was. Here's the code i changed, gonna leave this marked as unsolved until the original problem is at least spotted.
[CODE]
void aMap:: initialize(int numCities, int numPaths) {
numberCities = numCities;
thePaths.resize(numPaths*2);
next = 0;
}

void aMap::buildPaths (int from, int to) {
thePaths[next].from = from;
thePaths[next].to = to;
thePaths[next].good = false;
next++;

}
[/CODE]

Ran my program with removeStores never being called, but it didnt work. Here it is anyways
[CODE]void aMap::removeStores() {
int gnumBadPaths = 0; //greatest num bad paths
int storeWMBP; //Store with most bad paths

tallyBadPaths();

if (testMap() == false ) {      //If map doesnt meet requirements delete a store
    for (int i = 0; i < theStores.size(); i++) {
        if (theStores[i].numBadPaths > gnumBadPaths) {
            storeWMBP = i;
        }
    }

    theStores[storeWMBP].open = false;

    tallyBadPaths();

    if (testMap() == false) {   //store closed, still doesnt pass test
        removeStores();
    }
}

}
[/CODE]

[I]To make it easier to read, only the relevant code is below, and due to circumstances beyond my control im stuck using Xcode for the next week or so (hate this debugger).[/I]

I need help fixing a seg_fault in my current program. It occurs the last time "buildPaths" is called. I feel like im going outside of the "thePaths" vector, but the fixes I've tried did nothing.

Please tell me either
A) A solution, where the problem was, how to avoid it, how to go about fixing it
B) Where the problem is, how to go about fixing it, how to avoid it

[I]Remember i basically have no debugger for a while[/I]

Sample input
1
3 2
1 2
2 3
Output:
2
1 3

EDIT: If you know of something better than Xcode for a mac please share

[CODE]
struct path {
int from;
int to;
bool good;
};
struct store {
int numBadPaths;
bool open;
};
class aMap {
private:
int next;
int numberCities;
vector <path>thePaths;
vector <store>theStores;
bool testMap();
void tallyBadPaths ();

public:
void initialize (int numCities, int numPaths);
void buildPaths (int form , int to);
void removeStores();
void print();

};
void aMap::buildPaths(int from, int to){

thePaths[next].from = from;
thePaths[next].to = to;
thePaths[next].good = false;
next++;

}
void aMap::initialize(int numCities, int numPaths) {
theStores.resize(numCities);
thePaths.resize(numPaths);
numberCities = numCities;
next = 0;
for (int i = 0; i < theStores.size(); i++) {
theStores[i].open = true;
}
}
int main () {
int numCases, numCities, numPaths, from, to;
aMap ...