fork download
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <string>
  4. #include <cctype>
  5.  
  6. using namespace std;
  7.  
  8. void rect(int w, int h)
  9. {
  10. cout << string(w, '*') << endl;
  11. for(int i = 0; i < h - 2; ++i)
  12. cout << '*' << string(w - 2, ' ') << '*' << endl;
  13. cout << string(w, '*') << endl;
  14. }
  15. int main()
  16. {
  17. rect(8, 5);
  18. }
Success #stdin #stdout 0s 3472KB
stdin
Standard input is empty
stdout
********
*      *
*      *
*      *
********