FooL
April 28th, 2001, 12:46 PM
I have this assignment for intro to prog and my instructor is *famous* for giving us assignments using things that we'd have no way of knowing about. Here's the question. (Remember, I'm not asking for the whole solution, just a "key command" or something to get me pointed in right direction.
Here's the Q: What kind of cout << do I use to get this to happen?
I need to make a shape based on user input. i.e. if the user typed in a x and a 5 the output would be like this:
x
xxx
xxxxx
xxx
x
I understand the counters, loops, if, and while statements I'll be using. Here's the problem. How do I get the prog to output varying instances of the variable "Letter". in other words, how do I get it to do 1 x then 3 x's and then 5 x's everytime I enter a new loop?
I've tried working a counter that adds 2 to itself every loop and then trying something like:
cout << Letter * counter << endl;
But I end up getting the ANSCI equivalent of the Letter times the value of counter. (So it outputs like 282 instead of XXXXX or something....)
Any help is very much appreciated!
Here's the Q: What kind of cout << do I use to get this to happen?
I need to make a shape based on user input. i.e. if the user typed in a x and a 5 the output would be like this:
x
xxx
xxxxx
xxx
x
I understand the counters, loops, if, and while statements I'll be using. Here's the problem. How do I get the prog to output varying instances of the variable "Letter". in other words, how do I get it to do 1 x then 3 x's and then 5 x's everytime I enter a new loop?
I've tried working a counter that adds 2 to itself every loop and then trying something like:
cout << Letter * counter << endl;
But I end up getting the ANSCI equivalent of the Letter times the value of counter. (So it outputs like 282 instead of XXXXX or something....)
Any help is very much appreciated!