Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void topbar(int length) {
- for (int i = 0; i < length+4; ++i) {
- cout << "*";
- }
- cout << "\n";
- }
- void nextline(int length) {
- cout << "*";
- for (int i = 0; i < length+2; ++i) {
- cout << " ";
- }
- cout << "*\n";
- }
- void name(string meno) {
- cout << "*";
- cout << " ";
- cout << meno;
- cout << " ";
- cout << "*\n";
- }
- int main()
- {
- string nombre;
- cout << "What is your name? ";
- getline(cin, nombre);
- int width = nombre.length();
- topbar(width);
- nextline(width);
- name(nombre);
- nextline(width);
- topbar(width);
- return 0;
- }
Add Comment
Please, Sign In to add comment