虽然不能去第2记录。 [英] while can't go to the 2nd record.

查看:68
本文介绍了虽然不能去第2记录。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

有人可以告诉我为什么我一边读取第二个,第三个......记录吗?

(这是我代码的一部分。 )

我已经在书本和互联网上找了它,但是juist没有看到

的问题。

TI @

Wen

int klantNr,access;

Client MutatieRec,MasterRec;

OpenBestand(access);


LeesMutatie(MutatieRec,klantNr);

而(MutatieRec.klantNr!= HV)// HV被定义为99999

{

cout<< MutatieRec.klantNr;

LeesMutatie(MutatieRec,klantNr);

}

cin .get();


-


遇见vriendelijke groet,

Wen

Hallo,
Can someone tell me why my while doenst read the second, third.... record?
(This''s a part of my code.)
I''ve looked for it in the books and on internet, but juist don''t see the
probleem.
TI@
Wen
int klantNr, access;
Client MutatieRec, MasterRec;
OpenBestand(access);

LeesMutatie( MutatieRec, klantNr);
while( MutatieRec.klantNr !=HV) //HV is defined as 99999
{
cout<<MutatieRec.klantNr;
LeesMutatie( MutatieRec, klantNr);
}
cin.get();

--

Met vriendelijke groet,

Wen

推荐答案

" Wen" <我们************ @ hccnet.nl>写了...
"Wen" <We************@hccnet.nl> wrote...
有人可以告诉我为什么我的doenst读取第二,第三......记录?
(这是我的代码的一部分。)
我已经在书本和互联网上找到了它,但是juist没有看到
问题。
TI @
Wen

int klantNr,访问;
Client MutatieRec,MasterRec;
OpenBestand(访问);

LeesMutatie(MutatieRec,klantNr);
while(MutatieRec.klantNr!= HV)// HV被定义为99999
{
cout<< MutatieRec.klantNr;
LeesMutatie(MutatieRec,klantNr);
}
cin.get();
Can someone tell me why my while doenst read the second, third.... record?
(This''s a part of my code.)
I''ve looked for it in the books and on internet, but juist don''t see the
probleem.
TI@
Wen
int klantNr, access;
Client MutatieRec, MasterRec;
OpenBestand(access);

LeesMutatie( MutatieRec, klantNr);
while( MutatieRec.klantNr !=HV) //HV is defined as 99999
{
cout<<MutatieRec.klantNr;
LeesMutatie( MutatieRec, klantNr);
}
cin.get();




AFAICT,''LeesMutatie''尚未在此计划中定义。它可能是因为它不能正常工作吗?发布完整的代码,而不是一些无法验证的
片段。



AFAICT, ''LeesMutatie'' has not been defined in this program. Could it
be the source why it''s not working? Post complete code, and not some
fragments that are impossible to validate.


Wen写道:
Wen wrote:
你好,
有人可以告诉我为什么我在读的第二个,第三个......记录?
(这是我的代码的一部分。)
Hallo,
Can someone tell me why my while doenst read the second, third.... record?
(This''s a part of my code.)



修改代码,如下所示。如果它打印Mutatie.klantNr等于

HV,则问题不在你提供的代码片段中。


// --- -------------------------------------------------- ----

int * klantNr,* access;

Client * MutatieRec,* MasterRec;


if(MutatieRec。 klantNr == HV){

cout<< Mutatie.klantNr等于HV。 <<结束;

}


OpenBestand(访问);


if(MutatieRec.klantNr == HV){

cout<< Mutatie.klantNr等于HV。 <<结束;

}

LeesMutatie(* MutatieRec,* klantNr);

if(MutatieRec.klantNr == HV){

cout<< Mutatie.klantNr等于HV。 <<结束;

}

while(* MutatieRec.klantNr *!= HV)** // HV * *定义*为* 99999

{

cout<< MutatieRec.klantNr;

LeesMutatie(* MutatieRec,* klantNr);

}

cin.get();

// ---------------------------------------------- -----------


-

CrayzeeWulf


Modify the code as show below. If it prints "Mutatie.klantNr is equal to
HV", then problem is not in the code fragment you provided.

// ---------------------------------------------------------
int*klantNr,*access;
Client*MutatieRec,*MasterRec;

if ( MutatieRec.klantNr == HV ) {
cout << "Mutatie.klantNr is equal to HV" << endl ;
}

OpenBestand(access);

if ( MutatieRec.klantNr == HV ) {
cout << "Mutatie.klantNr is equal to HV" << endl ;
}
LeesMutatie(*MutatieRec,*klantNr);
if ( MutatieRec.klantNr == HV ) {
cout << "Mutatie.klantNr is equal to HV" << endl ;
}
while(*MutatieRec.klantNr*!= HV)**//HV*is*defined*as*99999
{
cout << MutatieRec.klantNr;
LeesMutatie(*MutatieRec,*klantNr);
}
cin.get();
// ---------------------------------------------------------

--
CrayzeeWulf


好,我不能发布我的所有代码,它真的很多。但是我会选择这个

部分,以便你可以看出它有什么问题。

问候,




#include< iostream>

#include< ctime>

#include< string>

#include< cstring>

#include< fstream>


const int HV = 99999;


struct Client

{

int klantNr;

char soort [2];

char naam [26];

char adres [26];

char postcode [7];

char plaats [16];

int bankNr;

int giro;

char mutcode [2];

char tariefAfspr [2];

};


使用命名空间std;

void OpenBestand(int& access);

void LeesMutatie(Client & MutatieRec,int& klantNr);


int main()

{

int klantNr,access;

Client MutatieRec,MasterRec;

OpenBestand(访问);


Le esMutatie(MutatieRec,klantNr);

while(MutatieRec.klantNr!= HV)

{

cout<<< MutatieRec.klantNr;

LeesMutatie(MutatieRec,klantNr);

}

cin.get();

}


void LeesMutatie(客户& MutatieRec,int& klantNr)

{

ifstream mutatie(" mutatie.csv");

char puntkomma ='';'';


mutatie>> MutatieRec.klantNr>> puntkomma;

mutatie.getline(MutatieRec.soort,2,'';'');

mutatie.getline(MutatieRec.naam,26,'';'' );

mutatie.getline(MutatieRec.adres,26,'';'');

mutatie.getline(MutatieRec.postcode,7,'';'' );

mutatie.getline(MutatieRec.plaats,16,'';'');

mutatie>> MutatieRec.bankNr>> puntkomma;

mutatie>> MutatieRec.giro>> puntkomma;

mutatie.getline(MutatieRec.mutcode,2,'';'');

mutatie.getline(MutatieRec.tariefAfspr,2,'';'' );

if(mutatie.eof())

MutatieRec.klantNr = HV;

}


void OpenBestand(int& access)

{

ifstream constant,klant,mutatie;


constant.open( " constant.csv");

if(constant.fail())

{

cerr<< Het constantenbestand kon niet worden geopend << endl;

access = 0;

}


klant.open(" klant.dat",ios :: binary );

if(klant.fail())

{

cerr<< Het klantenbestand kon niet worden geopend << endl;

access = 0;

}


mutatie.open(" mutatie.csv");

if(mutatie.fail())

{

cerr<< Het mutatiebestand kon niet worden geopend << endl;

access = 0;

}

}

" Victor Bazarov" <五******** @ comAcast.net> schreef in bericht

news:5IoIb.79856
Well, I can''t post all my code, it''s really to much. But I''d select this
part, so that you can can see what''s wrong with it.
Regards,
Wen

#include <iostream>
#include <ctime>
#include <string>
#include <cstring>
#include <fstream>

const int HV= 99999;

struct Client
{
int klantNr;
char soort[2];
char naam[26];
char adres[26];
char postcode[7];
char plaats[16];
int bankNr;
int giro;
char mutcode[2];
char tariefAfspr[2];
};

using namespace std;
void OpenBestand(int& access);
void LeesMutatie(Client & MutatieRec, int & klantNr);

int main()
{
int klantNr, access;
Client MutatieRec, MasterRec;
OpenBestand(access);

LeesMutatie( MutatieRec, klantNr);
while( MutatieRec.klantNr !=HV)
{
cout<<MutatieRec.klantNr;
LeesMutatie( MutatieRec, klantNr);
}
cin.get();
}

void LeesMutatie(Client & MutatieRec, int & klantNr)
{
ifstream mutatie ("mutatie.csv");
char puntkomma = '';'';

mutatie >> MutatieRec.klantNr >> puntkomma;
mutatie.getline(MutatieRec.soort, 2, '';'');
mutatie.getline(MutatieRec.naam, 26, '';'');
mutatie.getline(MutatieRec.adres, 26, '';'');
mutatie.getline(MutatieRec.postcode,7, '';'');
mutatie.getline(MutatieRec.plaats, 16, '';'');
mutatie >> MutatieRec.bankNr >> puntkomma;
mutatie >> MutatieRec.giro >> puntkomma;
mutatie.getline(MutatieRec.mutcode, 2, '';'');
mutatie.getline(MutatieRec.tariefAfspr, 2, '';'');
if (mutatie.eof())
MutatieRec.klantNr = HV;
}

void OpenBestand(int& access)
{
ifstream constant, klant, mutatie;

constant.open("constant.csv");
if(constant.fail())
{
cerr << "Het constantenbestand kon niet worden geopend" << endl;
access = 0;
}

klant.open("klant.dat", ios::binary );
if(klant.fail())
{
cerr << "Het klantenbestand kon niet worden geopend" << endl;
access = 0;
}

mutatie.open("mutatie.csv");
if(mutatie.fail())
{
cerr << "Het mutatiebestand kon niet worden geopend" << endl;
access = 0;
}
}
"Victor Bazarov" <v.********@comAcast.net> schreef in bericht
news:5IoIb.79856


这篇关于虽然不能去第2记录。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆