Answer to Question #317462 in C++ for fiona

Question #317462

HOW TO WRITE A PROGRAM THAT DISPLAYS YOUR NAME INSIDE A BOX ON THE CONSOLE SCREEN?


1
Expert's answer
2022-03-26T05:45:08-0400
#include <iostream>
#include <string>


using namespace std;


int main() {
    string name;
    cout << "Enter yout name: ";
    getline(cin, name);
    
    int length = name.size();
    
    cout << "+";
    for (int i = 0; i < length; i++) {
        cout << "-";
    }
    cout << "+\n";
    
    cout << "|" <<  name << "|";
    
     cout << "\n+";
    for (int i = 0; i < length; i++) {
        cout << "-";
    }
    cout << "+\n";
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog