Problem 44380. ASCII Birthday Cake
Given an age and a name, give draw an ASCII birthday cake. For example, given the name "CODY" and the age 5, return a string with the following (no trailing spaces)
6 6 6 6 6 | | | | | __|_|_|_|_|__ { } { } { CODY } { } {_____________}
This uses the string datatype, not a char array.
Solution Stats
Problem Comments
-
4 Comments
can anyone check my solution 1292494. it look like when i convert to string it add a space before EOL (ascii 10).
I don't find from where it came
Maybe it comes from the new matlab strings introduced only recently in R2017a. You can notices them by the 'string' constructor and the double quotes in the test cases.
String concatenation and some other things seem to work differently for them, than for the good old char arrays.
maybe you right. the question is how i can remove it after or during the construction?
I found the difference and add a patch (cost me 50 in length)
Solution Comments
Show commentsProblem Recent Solvers221
Suggested Problems
-
How to find the position of an element in a vector without using the find function
2728 Solvers
-
Project Euler: Problem 2, Sum of even Fibonacci
2299 Solvers
-
Make an awesome ramp for a tiny motorcycle stuntman
652 Solvers
-
Get the elements of diagonal and antidiagonal for any m-by-n matrix
476 Solvers
-
Solve a System of Linear Equations
11944 Solvers
More from this Author56
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!