Write a C++ program that use your first and last name as a string.
example name ABCXYZ
Write a program that generates the following output, using 4 separate loops
$ OR N
C$X HNS
BC$XY OHNSO
ABC$XYZ JOHNSON
Solution
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char* argv[])
{
int i;
for(i=1;i<=3;i++)
{
string s1=\"ABC\";
s1.erase (i,s1.size());
s1.append(\"$\");
string s2=\"XYZ\";
s2.erase (i,s2.size());
s1.append(s2);
std::cout << s1 << \'\ \';
}
return 0;
}
.