Please take a look at the following code. When I do not put my pointers in an array the code works. See the commented out section. I thought it would be nice to do an array as I could then have more control over my output. I could also add additional items easier in the future.

The problem is when its in an array i never get prompted for input. Its like a big empty buffer.

#include <iostream>
#include "cdrom.h"
#include "cdromsupport.h"

using namespace std;


int main ()
{
        // Declares 3 CDROM Pointers
    CDROM *pCDROM1;
    CDROM *pCDROM2;
    CDROM *pCDROM3;
    CDROM *pCDs[3];
    
    
    
        //Check For Dynamic Memory Allocation
    pCDROM1 = new CDROM;
    if (pCDROM1 == NULL)
        {
        cout << "Dynamic Memory Allocation FAILED" << endl;
        }
    
    pCDROM2 = new CDROM;
    if (pCDROM2 == NULL)
        {
        cout << "Dynamic Memory Allocation FAILED" << endl;
        }
    
    pCDROM3 = new CDROM;
    if (pCDROM3 == NULL)
        {
        cout << "Dynamic Memory Allocation FAILED" << endl;
        }
        
    
        // Loads each CDROM with data
    
    for (int i = 0; i < 3; i++)
        {
        pCDs[i]->loadInfo();
        }
    
    for (int i = 0; i < 3; i++)
        {
        pCDs[i]->displayInfo();
        }
    
/*
    pCDROM1->loadInfo();
    pCDROM2->loadInfo();
    pCDROM3->loadInfo();
    
    pCDROM1->displayInfo();
    pCDROM2->displayInfo();
    pCDROM3->displayInfo();

    
    
        // calls global function show cost
        // showcost();
    
        // Changes data on CDROM 1 and CDROM 2
    pCDROM1->changeData();
    pCDROM2->changeData();
    pCDROM3->changeData();
    
        // Redisplay CDROM with New Data
    pCDROM1->displayInfo();
    pCDROM2->displayInfo();
    pCDROM3->displayInfo();
*/    
        // Call giveMemoryBack function
        giveMemoryBack(pCDROM1, pCDROM2, pCDROM3);
    
    return 0;

}

The problem is that you don't initialize your pointers to point to anything. You have to do the same as you do for (pCDROM1, pCDROM2, pCDROM3) pointers but for each pCDs element. As in:

for (int i = 0; i < 3; i++)
        {
        pCDs[i] = new CDROM;
        if (pCDs[i] == NULL)
            {
            cout << "Dynamic Memory Allocation FAILED" << endl;
            }
        }

That makes since but it still dose not ever do the load data. So I never get prompted for input. Again its just like a big empty buffer. I can press enter and type anything and no response.

#include <iostream>
#include "cdrom.h"
#include "cdromsupport.h"

using namespace std;


int main ()
{
        // Declares 3 CDROM Pointers
/*  CDROM *pCDROM1;
    CDROM *pCDROM2;
    CDROM *pCDROM3;
*/    
    
    CDROM *pCDs[3];
    
    
    
        //Check For Dynamic Memory Allocation
 /*   pCDROM1 = new CDROM;
    if (pCDROM1 == NULL)
        {
        cout << "Dynamic Memory Allocation FAILED" << endl;
        }
    
    pCDROM2 = new CDROM;
    if (pCDROM2 == NULL)
        {
        cout << "Dynamic Memory Allocation FAILED" << endl;
        }
    
    pCDROM3 = new CDROM;
    if (pCDROM3 == NULL)
        {
        cout << "Dynamic Memory Allocation FAILED" << endl;
        }
        
 */   
        // Loads each CDROM with data
    
    
    for (int i = 0; i < 3; i++)
        {
        pCDs[i] = new CDROM;
        if (pCDs[i] == NULL)
            {
            cout << "Dynamic Memory Allocation FAILED" << endl;
            }
        }
    
    for (int i = 0; i < 3; i++)
        {
        pCDs[i]->loadInfo();
        }
    
    for (int i = 0; i < 3; i++)
        {
        pCDs[i]->displayInfo();
        }
    
/*
    pCDROM1->loadInfo();
    pCDROM2->loadInfo();
    pCDROM3->loadInfo();
    
    pCDROM1->displayInfo();
    pCDROM2->displayInfo();
    pCDROM3->displayInfo();

    
    
        // calls global function show cost
        // showcost();
    
        // Changes data on CDROM 1 and CDROM 2
    pCDROM1->changeData();
    pCDROM2->changeData();
    pCDROM3->changeData();
    
        // Redisplay CDROM with New Data
    pCDROM1->displayInfo();
    pCDROM2->displayInfo();
    pCDROM3->displayInfo();
*/    
        // Call giveMemoryBack function
        //     giveMemoryBack(pCDROM1, pCDROM2, pCDROM3);
    
    return 0;

}

Then it is a problem with either your default constructor for the CDROM class or with the loadInfo() or displayInfo() functions. Post the relevant code (i.e. those three functions at least), and we can look into it.

I can press enter and type anything and no response.

Where is that in your code? We can't help if we don't have what we need on hand.

Sorry I thought the issue was in the section of code I posted. I did however find this out. If I compile my code in Visual Studio 2010 everything works fine. However if I compile in XCode 4.2 then I get the empty lines that I cant do anything with. For now I am satisfied with the VS 2010 option. I would however like to understand why its not cross platform at this point. As I'm not using any specific windows STL's or calls

However if I compile in XCode 4.2 then I get the empty lines that I cant do anything with... would however like to understand why its not cross platform at this point.

Again: If you don't post the code, we can't provide any feedback of what the issue might be!

This question has already been answered. Start a new discussion instead.