what's wrong with this code, when i try to make the pyramid, it's always the same height of the pyramid. and somehow onumber always has the value of 20, WHY??!!
Here is the code and I'll also include a picture of how it looks.

#include <iostream>
#include <iomanip>

using namespace std;

int main()
{   
int number;
int onumber;
number = onumber;
char value;
cout << "what character do you want to fil the pyramid with? >> ";
cin >> value;
cout << "\nHow many lines shall the pyramid be? >> ";
cin >> number;
int i =0;
int y = number;
while(i < onumber) {
cout.width(y);
cout.fill(' ');
cout << "";
y--;
cout.width(number-(number-(number-1)));
cout.fill(value);
cout << "" << endl;
++number;
++number;
onumber--;
}
cin.get();
cin.get();
return 0;
}

This :

int number;
int onumber;
number = onumber;
char value;
cout << "what character do you want to fil the pyramid with? >> ";
cin >> value;
cout << "\nHow many lines shall the pyramid be? >> ";
cin >> number;
int i =0;
int y = number;
while(i < onumber)

is gibberish. I have no clue at all what you're trying to do here, but it uses all kinds of undefined variables.
How about you try something like this:

int lines = 0;
cout << "how many lines?\n";
cin >> lines;
for (int i = 0; i < lines; i++) {
    cout << "line " << i << '\n';
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.