
//*****************************************************************************
////  Course:             COMS 2104 03 Foundations of Computer Programming I
////  Semester:           Spring 2004
////  Assignment Number:  #6                             
////  Author Name:        DarC KonQuesT                        
////  Date Written:      March 25, 2004
////                                                         
////  Description of Program:                              
////  Takes an filename/string input and prints asterisks in the amount    
////  defined on each line of the input file.                            
////*****************************************************************************

#include <iostream>
#include <string>
#include <fstream>

using namespace std;

void print_stars(int n);

int main()
{
        ifstream input_file;
        string fname;
        int x;

        cout << "Enter Input file name: ";
        cin >> fname;
        input_file.open(fname.c_str());
        if(!input_file)
        {
        cout << "Error: Can't open file." << endl;
        return 1;
        }

cout << "0         1         2         3         4         5" << endl;
cout << "+----+----+----+----+----+----+----+----+----+----+" << endl;
input_file >> x;
        while(input_file)
        {
                print_stars(x);
		input_file >> x;
        }
cout << "+----+----+----+----+----+----+----+----+----+----+" << endl;
cout << "0         1         2         3         4         5" << endl;
        input_file.close();

return 0;
}

void print_stars(int n)
{
	cout << "|";
        for(int i = 0; i < n; ++i)
        cout << "*";
        cout << endl << endl;
}


