大家帮 忙看一下啊
我写了一个数据库程序
#include<fstream.h>
struct Date
{
int iMonth, iDay, iYear;
};
struct Product
{
int iPartNumber;
char szName[80];
double dPrice;
};
struct Customer
{
int iID;
char szName[50];
char szAddress[50];
char szCity[20];
char szState[20];
char szZip[9];
};
void main()
{
Date dt = {6, 10, 92};
Product prod = {122, "Vegamatic",19.95};
Customer cust = {15, "Seymore Hoskins", "300 Oak St",
"Boring", "Oregon", "97203"};
ofstream datafile("ata.dat", ios::binary);
datafile.write((char *)&dt, sizeof dt);
datafile.write((char *)&prod, sizeof prod);
datafile.write((char *)&cust, sizeof cust);
}
然后我写了一个程序读 它生成的数据库文件 ata.dat
#include<iostream.h>
#include<fstream.h>
#include<main.cpp>//是上面那个程序文件
int main()
{
ifstream is("data.dat", ios::binary|ios::nocreate);
if(is)
{
is.read((char*)&dt, sizeof(dt));
is.read((char*)&prod, sizeof(prod));
out<<prod.szName<<endl;
}
else
{
cout<<"ERROR:Cannot open file 'data.dat'."<<endl;
}
}
Compiling...
main1.cpp
D:\MyProjects\exmple4\main1.cpp(3) : fatal error C1083: Cannot open include file: 'main.cpp': No such file or directory
Error executing cl.exe.
exmple4.exe - 1 error(s), 0 warning(s)
却出现如上错误
请各位大哥门帮我看看 错在那里
小弟感激不尽