help flipping stars around on this program

#include<iostream>
#include<iomanip>
#include<fstream>
#include<cstdlib>
#include<string>

using namespace std;

const int a = 8;
int i, j, ary[1], n, s1 =-1;
char response;

void main()
{
string ifilename, ofilename, line , file1, name, reply;
ifstream inFile, checkOutFile;
ofstream outFile;

//Input file
cout << "Please enter the name of the file you wish to open : ";
cin >> ifilename;

inFile.open(ifilename);

if (inFile.fail())
{
cout << "The file " << ifilename << " was not successfully opened." << endl;
cout << "please check the path and name of the file. " << endl;
exit(1);
}
else
{
cout << "The file was successfully opened." << endl;
}
//Output file
cout << "Please enter the name of the file you wish to write : ";
cin >> ofilename;

if (!checkOutFile.fail())
{
cout << "A file " << ofilename << " exists. \nDo you want to coninue and ovewrite it? (y/n) : ";
cin >> response;
if (tolower(response) == 'n')
{
cout << "the existing file will not be overwritten. " << endl;
exit(1);
}
}
outFile.open(ofilename);
if (outFile.fail())
{
cout << "the file " << ofilename << "was not successfully opened. " << endl;
cout << "Please check the path and name of the file. " << endl;
exit(1);
}
else
{
cout << "The file is succesfully opened. " << endl;
}

int Lnum;
inFile >> Lnum;

int w = 10000000;
int fake;
int Array[8] = { 0 };
int largest = 0;

for (int i = 0; i < 8; i++)
{
fake = Lnum / w;
Array[i] = fake;
Lnum = Lnum % w;
w = w / 10;

if (Array[i]>largest)
largest = Array[i];
}
cout << endl;
for (int i = 0; i < 8; i++)
{
cout << Array[i]; outFile << Array[i];
}
cout << endl; outFile << endl;
for (int i = largest; i >= 1; i--)
{
for (int j = 0; j < 8; j++)
{
if (Array[j] < i){ cout << ' '; outFile << ' '; }
else{ cout << '*'; outFile << '*'; }
}
cout << endl;
outFile << endl;
}



inFile.close();
outFile.close();
}//main




Topic archived. No new replies allowed.