#include "stdafx.h" #include <iostream> using namespace std; int main() { int beginLetter = 65; int letterCount = 6; for (int i = 1; i <= letterCount; i++) { for (int j = 1; j <= i; j++) { cout << char(beginLetter); beginLetter++; } cout << endl; beginLetter = 65; } cin.get(); return 0; }
Output
Notes
#include "stdafx.h" #include <iostream> using namespace std; int main() { int beginLetter = 65; int n; cout << "Enter height: " << endl; cin >> n; for (int i = 1; i <= n; i++) { for (int j = 1; j <= i; j++) { cout << char(beginLetter); beginLetter++; } cout << endl; beginLetter = 65; } cin.get(); cin.get(); return 0; }