我试图创建一个顺序文件,但它似乎并没有工作。任何人都可以解释如何让它在MS Visual Studio 2010中工作吗?创建一个顺序文件
#include <iostream>
#include <string>
#include <fstream>
#include <cstdlib>
using namespace std;
int main()
{
ofstream outClientFile("clients.dat", ios::out);
if (!outClientFile)
{
cerr << "File could not be opened" << endl;
exit(1);
}
cout << "Enter the Appointment Date, Time, Duration, Name," << endl
<< "Description, Contact Name, and Contact Number.\n? ";
int appDate, appTime, appContactNum;
string appName, appDescription, appContactName;
double appDuration;
while (cin >> appDate >> appTime >> appDuration >>
appName >> appDescription >> appContactName >> appContactNum)
{
outClientFile << appDate << ' ' << appTime << ' ' << appDuration << ' ' << appName << ' ' << appDescription << ' ' << appContactName << ' ' << appContactNum << endl;
cout << "? ";
}
}
这里是我输入一行后的输出。
Loaded 'C:\Windows\SysWOW64\ntdll.dll', Cannot find or open the PDB file
Loaded 'C:\Windows\SysWOW64\kernel32.dll', Cannot find or open the PDB file
Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Cannot find or open the PDB file
Loaded 'C:\Windows\SysWOW64\msvcp100d.dll', Symbols loaded.
Loaded 'C:\Windows\SysWOW64\msvcr100d.dll', Symbols loaded.
The program '[452] CSC275 Assignment 3.exe: Native' has exited with code 0 (0x0).
你能举一个你正在使用的输入的例子吗? – 2011-03-07 02:00:06
以下是我正在使用的输入:03062011 1030 2.5牙医清洁Joshua 5552492131 – Joshua 2011-03-07 02:01:54
我可能已经完成了它的工作。我只是将我的int变量改为double。 – Joshua 2011-03-07 02:04:39