repetition question

hello

i am having trouble completing an assignment. i am able to create a single sided bow.. like this:
**********
*********
********
*******
******
*****
****
***
**
*
**
***
****
*****
******
*******
********
*********
**********

**********
*********
********
*******
******
*****
****
***
**
*
**
***
****
*****
******
*******
********
*********
**********


but i cannot get them to be side by side
like this
********************
******************
****************
**************
************
**********
********
******
****
**
****
******
********
**********
************
**************
****************
******************
********************

this is my program thus far: #include <iostream>
#include <iomanip>
#include <string>
#include <fstream>
using namespace std;

int main() {

ofstream writeFile;
writeFile.open("output4a.txt");
if (!writeFile)
{ cout << "Error to open output4a.txt"; }
else
{
string star = "*";
int number;
cout << "Number of asterisks? ";
cin >> number;

for (int row= number; row >= 1; row--)
{
for (int col = 1; col <= row; col++)
{ writeFile << star;
cout << star; //cout << "*";
} //end of inner loop
writeFile << endl;
cout << endl; //begin the line
} //outer for

star = "**";
//the second half of the bow of asterisks
for (int row = 2; row <= number; row++)
{
writeFile << star << endl;
cout << star << endl;
star = star + "*";

}//end of for

cout << endl;
writeFile << endl;
//program segment which generates its reverse.
for (int row = number; row >= 1; row--)
{
for (int col = 1, blank = number - row, count =1; col <= row; col++)
{
if (blank >= 0 && count == 1)
{
cout << setw(blank+1) << "*";
writeFile << setw(blank+1) << "*";
count++;}
else
{
writeFile << "*";
cout << "*";
}//end if else

}//inner for
writeFile << endl;
cout << endl;
}//out for

star = "**";
//the second half of the bow of asterisks
for (int row = 2; row <= number; row++)
{
writeFile << setw(number) << star << endl;
cout << setw(number) << star << endl;
star = star + "*";

}//end of for

//generates its image
cout << endl;
writeFile << endl;
//program segment which generates its reverse.



for (int row = number; row >= 1; row--)
{
for (int col = 1, blank = number - row, count =1; col <= row; col++)
{
if (blank >= 0 && count == 1)
{
cout << setw(blank+1) << "*" << "*" ;
writeFile << setw(blank+1) << "*" << "*";
count++;}
else
{
writeFile << "*" << "*";
cout << "*" << "*";
}//end if else

}//inner for
writeFile << endl;

cout << endl;
}//out for

star = "**";
//the second half of the bow of asterisks
for (int row = 2; row <= number; row++)
{
writeFile << setw(number) << star << star << endl;
cout << setw(number) << star << star << endl;
star = star + "*";

}//end of for


for (int row= number + number; row >= 1; row--)
{
for (int col = 1; col <= row; col++)
{ writeFile << star;
cout << star; //cout << "*";
} //end of inner loop
writeFile << endl;
cout << endl; //begin the line
} //outer for

star = "**";

system: ("pause");

cout << endl << ;
}
writeFile.close();

return 0; }
Last edited on
Topic archived. No new replies allowed.