|
-
September 22nd, 1999, 06:40 AM
#1
stdafx and deque<int>
I can't compile my program when I use "stdafx.h" and deque<int>.
Please help me ! Thank you !!
ccode
// Zahl.cpp : implementation file
//
#include "stdafx.h"
#include "Slot.h"
#include "Zahl.h"
//#include <cstdlib>
#include <iostream>
#include <functional>
#include <deque>
#include <algorithm>
#include <time.h>
#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: oDataExchange(CDataExchange* pDX)
{
CDialog: oDataExchange(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<int> rand_container(6);
typedef deque<int>::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 < 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<int>());
// 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 < rand_container.size(); i++) {
if(Pruef_zahl == rand_container[i]) {
Status_zahl = true;
}
}
return Status_zahl;
}
/ccode
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|