#include <iostream>
#include <fstream>
#include <cstring>
using namespace std;
void main()
{
char info[81];
string names[5];
double sales[5][5];
int count = 0;
int x = 0;
ifstream file;
file.open("sales.txt");
while(!file.eof())
{
x = 0;
file.getline(info, 80);
while(info[x] != (char)39)
{
while(info[x] != ' ')
{
names[count] += info[x];
x++;
}
x++;
for(int y = 0; y < 4; y++)
{
sales[count][atoi(&info[x])] = (atoi(&info[x + 1]) * 10) + atoi(&info[x+2]) + (.01 *((atoi(&info[x+4])*10) + atoi(&info[x+5])));
x += 7;
}
x++;
}
count++;
}
}
运行此程序时出现运行时错误,但我无法弄清楚原因。我对我的编译器调试器不是很熟悉,所以我在调试时遇到了麻烦。