Hey everyone,
I feel like I've asked this question before, and I searched through all my posts and couldnt find it, so I may just be going crazy, and if not I apologize for the redundancy.
So, I'm trying to use nested for loops to created a pyramid of X's,
as in:
......X
....XXX
..XXXXX
XXXXXXX etc...the dots are there to be abe to format the triangle, I don't need them in the program...
and I have the following code, but I have absolutely no idea how to insert the X's and I was looking for a push in the right direction NOT THE ACTUAL CODE...thanks a lot! <Helpless Chap
Code:
//Chapter 3
//Exercise 5
#include <iostream>
using namespace std;
int main()
{
const char X = 'X';
const char SPACE = '.';
unsigned int i;
for (i = 0; i < 21; i++)
{
for (int spaces = 0; spaces < 21; spaces++)
{
cout << SPACE;
if (spaces == 10)
{
cout << X;
//I want to use a for loop to print X to screen
}
}
cout << endl;
}
return 0;
}