Guest User

Untitled

a guest
Feb 19th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. void topbar(int length) {
  6. for (int i = 0; i < length+4; ++i) {
  7. cout << "*";
  8. }
  9. cout << "\n";
  10. }
  11.  
  12. void nextline(int length) {
  13. cout << "*";
  14. for (int i = 0; i < length+2; ++i) {
  15. cout << " ";
  16. }
  17. cout << "*\n";
  18. }
  19.  
  20. void name(string meno) {
  21. cout << "*";
  22. cout << " ";
  23. cout << meno;
  24. cout << " ";
  25. cout << "*\n";
  26. }
  27.  
  28. int main()
  29. {
  30. string nombre;
  31.  
  32. cout << "What is your name? ";
  33.  
  34. getline(cin, nombre);
  35.  
  36. int width = nombre.length();
  37.  
  38. topbar(width);
  39.  
  40. nextline(width);
  41.  
  42. name(nombre);
  43.  
  44. nextline(width);
  45.  
  46. topbar(width);
  47.  
  48. return 0;
  49. }
Add Comment
Please, Sign In to add comment