-3
我試圖設置一個計數器函數,它將計算輸入文件中的項目數並在消息框中顯示答案。我認爲我很接近,但我似乎無法讓它正常工作。 這裏是我的結構。如何在C++中使用這個計數器函數?
#pragma region Global Declarations
#include <iostream>
#include <fstream>
#include <iomanip>
struct PetData
{
int IdNumber;
char PetType[25];
double PetPrice;
//Count and display the number of items in the linked list
int CountItems;
PetData * Link;
};
PetData *Headpointer = NULL;
ifstream DataFile;
ofstream FileOut;
//Create a report listing the records
//that currently comprise the linked list
void ListRecords (char *);
void InsertItem (int, char[],double, PetData*);
void OutputItem (PetData*);
#pragma endregion
這裏就是我的櫃檯
OutputItem (Headpointer);
//FinalMessage->Visible=true;
Headpointer->ListRecords (OutPutFileName);
MessageBox::Show ("Listed Printed To Output File \n"
+ Headpointer->CountItems + " Items Were Printed",
"Report Created", MessageBoxButtons::OK,
MessageBoxIcon::Information);
//cleanup
DataFile.close();
FileOut.close();
delete CurrentRecordPointer;
Headpointer = NULL;
我感謝所有幫助你可以給。謝謝
你能比「我似乎無法讓它正常工作」更具體嗎? – molbdnilo 2014-12-04 14:47:34