Click to See Complete Forum and Search --> : stdafx and deque<int>


Hansi Stalder
September 22nd, 1999, 06:40 AM
I can't compile my program when I use "stdafx.h" and deque&lt;int&gt;.

Please help me ! Thank you !!

ccode
// Zahl.cpp : implementation file
//

#include "stdafx.h"
#include "Slot.h"
#include "Zahl.h"

//#include &lt;cstdlib&gt;
#include &lt;iostream&gt;
#include &lt;functional&gt;
#include &lt;deque&gt;
#include &lt;algorithm&gt;
#include &lt;time.h&gt;

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

//using namespace std;

/////////////////////////////////////////////////////////////////////////////
// CZahl dialog


CZahl::CZahl(CWnd* pParent /*=NULL*/)
: CDialog(CZahl::IDD, pParent)
{
//{{AFX_DATA_INIT(CZahl)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}


void CZahl::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CZahl)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CZahl, CDialog)
//{{AFX_MSG_MAP(CZahl)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CZahl message handlers

void CZahl::OnOK()
{

int Kombination [6] = {0,0,0,0,0,0};

deque&lt;int&gt; rand_container(6);

typedef deque&lt;int&gt;::iterator iter;

int Zufallszahl = 0;
bool Status_zahl = false;

srand((unsigned)time(NULL));

// Pro Kombination darf es keine gleichen Zahlen geben

for(int i = 0; i &lt; rand_container.size(); i++) {

Zufallszahl = get_zahl();
Status_zahl = pruef_zahl(Zufallszahl);

while(Status_zahl == true) {

Zufallszahl = get_zahl();
Status_zahl = pruef_zahl(Zufallszahl);
}

rand_container[i] = Zufallszahl;
}

// Werte sortieren

stable_sort(rand_container.begin(), rand_container.end(), less&lt;int&gt;());

// Werte ausgeben

int count = 0;
for(iter it = rand_container.begin(); it != rand_container.end(); it++) {

Kombination [count++] = *it;
}

}

// Generator für Zufallszahlen

int get_zahl() {

int zahl;
zahl = rand() % 45;
return zahl;
}

// Prüfen ob Zufallszahl bereits vorhanden ist

bool pruef_zahl(int Pruef_zahl) {

bool Status_zahl;
Status_zahl = false;

for(int i = 0; i &lt; rand_container.size(); i++) {

if(Pruef_zahl == rand_container[i]) {

Status_zahl = true;
}
}

return Status_zahl;
}

/ccode