Here is some code to get you started. Get this to compile and run on your system and begin working through it in iterations to put in 1 requirement at a time.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
#include <iostream>
#include <string>
int main()
{
std::string myName("alejandro");
for(int row = 0; row < myName.size(); row++)
{
std::cout << myName;
std::cout << '\n';
}
return 0;
}
|
As it works now, there are as many "rows" as there are characters in the string. Here are the iterations I would try to get working, in order:
1. Make the whole name print on the first row (row 0) only.
2. On the other rows, make the appropriate character print once.
3. On the other rows, make the appropriate character print twice.
4. On the other rows, print the appropriate amount of spaces between the characters discussed in steps 2 and 3 to give the impression of a diagonal print.
By this I mean, get 1. to work. Then get 2. to work, etc.