Help, I'm getting the following error message:

error C2040: 'money' : 'double' differs in levels of indirection from 'char [15]'
error C2088: '>>' : illegal for class

#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
#include <sstream>
#include <string.h>
using namespace std;

string FileName;
void starline();
float balance;
float deposit;
float check;
double m; 

void starline() //function declarator
{
for(int j=0; j<65; j++) //function body
cout << '-';
cout << endl;
}


int main()
{
    cout << "Enter a file name (including extension): " << endl;
    char FileName[300];
    cin.getline (FileName,300);
    ifstream input(FileName);

    if (!input.good())
    {
        cerr << "Unable to open file" << endl;
        exit(1);
    }

    while (!input.eof())
    {
        starline();
        char    deposit[15];
        input.getline(deposit, 15, ':');
        cout << left << setw(15) << deposit;

        char    date[15];
        input.getline(date, 15, ':');
        cout << setw(15) << date;

        char    place[15];
        input.getline(place, 15, ':');
        cout << setw(15) << place;

        char money[15];
        input.getline(money,15);
        cout << right  << setw(15) << "$ " << money << right << endl;
        starline();

        ifstream fin;
        double money = 0.0;
        fin.open(FileName);

        double m = atof ( money);
        //test for success, of course
        fin >> money; //input stored in the double

    }




    return 0;
}

Recommended Answers

All 2 Replies

lines 52 and 58 attempt to declare variables with the same name. Variable names must be unique.

alright, I can fix that one, but now my output is all screwey.. not a clue why.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.