can someone please help me figure out how to form an X shape with asterisks?

hey, can you guys please help me figure out how to make an x shape. so far, all i can do is get the one diagonal side with the following code, but i can't get the other side. i'd really appreciate any help. i really suck at for loops.
thanks a lot


#include <iostream>
using namespace std;

int main()
{
int number;


cout<< "Enter a number: ";
cin>> number;

while (number< 2 || number% 2 == 0)
{
cout << "Invalid response. Enter an odd number greater than or equal to 2:";
cin>> number;
}

for( int lineNum=0; lineNum<number; lineNum++)
{
cout <<"*";
for (int i=0; i<number-lineNum; i++)
cout<<" ";
cout<<endl;

for (int x= 0; x<= lineNum; x++)
cout<< " ";

}





cout<< endl;
system( "Pause");
return 0;

}
Topic archived. No new replies allowed.