lundi 23 mars 2020

How can I print Hi in huge block letters enclosed within a box of *?

I am required to output Hi in huge block letter which is enclosed in a box of * in C++. image of the output required So far Ive only managed to figure out a basic way where I print each line by line, but is there any smarter way to do it?

Heres what I managed so far

#include <iostream>
using namespace std;

int main(){
  cout << "**********************" << endl;
  cout << "*                    *" << endl;
  cout << "*   HH    HH     II  *" << endl;
  cout << "*   HH    HH     II  *" << endl;
  cout << "*   HH    HH     II  *" << endl;
  cout << "*   HH    HH     II  *" << endl;
  cout << "*   HHHHHHHH     II  *" << endl;
  cout << "*   HH    HH     II  *" << endl;
  cout << "*   HH    HH     II  *" << endl;
  cout << "*   HH    HH     II  *" << endl;
  cout << "*   HH    HH     II  *" << endl;
  cout << "*                    *" << endl;
  cout << "**********************" << endl;
  return 0;
}

Aucun commentaire:

Enregistrer un commentaire