cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
How to code a shape!!
How to code a shape!!
May 10, 2011 at 8:53pm UTC
jimmy5023
(159)
Anyone know how to code a shape?
What i mean is like a shape made of * i know how to do a normal array of * but not a heart, Christmas tree, etc...
May 10, 2011 at 9:25pm UTC
cnoeval
(643)
You might as well just hard-code it:
1
2
3
4
std::cout <<
" *"
std::cout <<
" ***"
std::cout <<
"*****"
std::cout <<
" *"
Makes a little Xmas tree.
If there is no easy way to define your shape mathematically that's pretty much the only way.
May 10, 2011 at 9:40pm UTC
filipe
(1165)
You might define it as a sequence of shapes (a triangle followed by a vertical line, for instance), but honestly I don't see why bother. There's a lot of more interesting, important stuff you could be learning instead.
May 12, 2011 at 1:08am UTC
jimmy5023
(159)
anyone have a link to those symbol so i can just copy and paste in the cout instead of ************ ** ****
May 12, 2011 at 1:30am UTC
ascii
(1062)
its not a common task, so i dont believe there are any of those symbols, youre just going to have to write them yourself.
Topic archived. No new replies allowed.