Okay I have tried everything to alter the code but nothing works, so I ask for your help.
The thing is I am trying to turn my code from this:
*______*
**____**
***__***
********
***__***
**____**
*______*
into this:
*________*
**______**
***____***
**********
***_**_***
**__**__**
*___**___*
____**
____**
____**
____**
____**
Replacing the underscores with spaces.
The side being depended on the entered number and the middle always being 10 by 2, so here is my code please help me alter it:
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
using namespace std;
const char symbol('*');
const char space(' ');
int main(int argc, char *argv[]){
string in;
stringstream ss;
int n, x;
x=1;
do {
cout << "Enter an integer(an odd number): ";
getline(cin,in);
ss.clear();
ss.str(in);
} while (!(ss >> n) || (n < 3) || (!(n & 1)));
char *symbols = new char[n + 1], *p = symbols + n - 1, it
*spaces = new char[(n * 2) - 1], *q = spaces;
fill(symbols, symbols + n, symbol);
symbols[n] = '\0';
fill(spaces, spaces + (n * 2) - 2, space);
spaces[(n * 2) - 1] = '\0';
do {
cout << p << q << p << endl;
if (p == symbols) x = -x;
p -= x; q += 2*x;
} while (q >= spaces);
system("PAUSE");
return EXIT_SUCCESS;
}