【发布时间】:2014-12-04 14:11:55
【问题描述】:
我正在尝试设置一个计数器功能,该功能将计算输入文件中的项目数并在消息框中显示答案。我想我已经接近了,但我似乎无法让它正常工作。 这是我的结构。
#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;
感谢您提供的任何帮助。谢谢
【问题讨论】:
-
您能否比“我似乎无法正常工作”更具体一些?
标签: c++ linked-list counter