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.
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.
so my teacher is asking to input a name so it has to print it vertically, horizontally and diagonally so far i have done vertically and horizontally but the only thing holding me back is how to print diagonally
#include <iostream>
#include <string>
int main()
{
std::string myName;
std::cout <<"Enter the name you wish to be printed: : ";
std::getline(std::cin,myName);
std::cout << std::endl << std::endl << myName << std::endl;
//Above prints full name text
for(int row = 1; row < myName.size(); row++) // prints 2nd letter onward
{
std::cout << myName[row];// prints name[row] letter
for(int x=1;x<row;x++)
{
std::cout << " "; // prints spaces up to where row is on name
}
std::cout << myName[row] << std::endl;
}
return 0;
}