Thread: The file when compiled does never show what the book has, but shows different....

  1. #1
    Registered User
    Join Date
    Dec 2019
    Posts
    99

    The file when compiled does never show what the book has, but shows different....

    ...though it isn't wrong. I just dislike the idea that it could be.

    Code:
    #include<iostream>#include<fstream>
    #include<iomanip>
    #include<string>
    #include<cstdlib>
    using namespace std;
    
    
    void outputLine(int, const string&, double);
    
    
    int main() {
    	ifstream inClientFile("clients.txt", ios::in);
    
    
    	if (!inClientFile) {
    		cerr << "File could not be opened" << endl;
    		exit(EXIT_FAILURE);
    	}
    	cout << left << setw(10) << "Account" << setw(13)
    		<< "Name" << "Balance\n" << fixed << showpoint;
    
    
    	int account;
    	string name;
    	double balance;
    
    
    	while (inClientFile >> account >> name >> balance) {
    		outputLine(account, name, balance);
    	}
    }
    
    
    void outputLine(int account, const string& name, double balance) {
    	cout << left << setw(10) << account << setw(13) << name << setw(7) << setprecision(2) << right << balance << endl;
    
    
    }
    When debugged the program says, "File could not be opened". Is this something wrong with cblocks and visual basic?

  2. #2
    Registered User
    Join Date
    May 2010
    Posts
    4,632
    When debugged the program says, "File could not be opened". Is this something wrong with cblocks
    Probably not.

    It is most likely that the file is not in the current working directory.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 06-03-2013, 01:33 PM
  2. Replies: 1
    Last Post: 02-04-2009, 03:00 PM
  3. Replies: 1
    Last Post: 03-12-2008, 12:10 AM
  4. Read a Compiled file of an RTU
    By c_geek in forum C Programming
    Replies: 1
    Last Post: 03-04-2008, 10:37 PM
  5. A TestUnit file cannot be compiled..
    By joenching in forum C++ Programming
    Replies: 5
    Last Post: 05-08-2005, 06:21 PM

Tags for this Thread