x shaped loop

PHOTO EMBED

Sat Oct 24 2020 11:35:47 GMT+0000 (UTC)

Saved by @mahmoud hussein #c++

#include <iostream>
#include<cmath>
#include<ctime>
#include<string>
#include <iomanip>
#include <fstream>

using namespace std;

int main()
{
	
	cout << " ##############";
	cout << endl;
	for (int  i = 0; i <=5; i++)
	{
		
		for (int j = 0;  j < 1;  j++)
		{
			cout << " " << "#";
		}
		for (int j = 1;  j <= i;  j++)
		{
                cout << " ";
		}
		for (int j = 0; j <1; j++)
		{
			cout << "#";
		}
		for (int j = i; j < 5; j++)
		{
			cout << " ";
		}
		for (int j = i; j < 5; j++)
		{
			cout << " ";

		}
		for (int j = 0; j <1 ; j++)
		{
			cout << "#";
		}
		for (int j = 0; j < i; j++)
		{
			cout << " ";
		}
		for (int i = 0; i < 1; i++)
		{
			cout << "#";
		}
		cout << endl;
	}

	for (int i = 0; i <=5; i++)
	{
		for (int j = 0; j < 1; j++)
		{
			cout << " " << "#";
		}
		for (int j = 5; j >i; j--)
		{
			cout << " ";
		}
		for (int j = 0;  j< 1; j++)
		{
			cout << "#";
		}
		for (int j = 0; j < i; j++)
		{
			cout << " ";
		}
		for (int j = 0; j < i; j++)
		{
			cout << " ";
		}
		for (int j = 0; j < 1; j++)
		{
			cout << "#";
		}
		for (int j = 5; j > i ; j--)
		{
			cout << " ";
		}
		for (int i = 0; i < 1; i++)
		{
			cout << "#";
		}
		cout << endl;
		
	}
	cout << " ##############";
	cout << endl;


}
content_copyCOPY

http://cpp.sh/