Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- std::string make_triangles() {
- uint8_t plus_1 = 1; //first number of +'s
- uint8_t spaces = 32; //space number (based on number of periods you gave in the post)
- uint8_t plus_2 = 10; //second number of +'s
- std::string result = ""; //final return result
- for (uint8_t i = 0; i < 10; ++i) {
- result.insert(result.length(), plus_1, '+');
- result.insert(result.length(), spaces, ' ');
- result.insert(result.length(), plus_2, '+');
- result.append("\n");
- ++plus_1, --plus_2, --spaces;
- }
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement