blob: 9e42110db601a2938488865a901052b83b343495 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#include <iostream>
#include <string>
int
main()
{
std::cout << "Enter your first name: ";
std::string name;
std::cin >> name;
const std::string greeting = "Hello, " + name + "!";
const std::string spaces(greeting.size(), ' ');
const std::string second = "* " + spaces + " *";
const std::string first(second.size(), '*');
const std::string exclam = "!";
const std::string msg = "Hello" + ", world" + exclam;
std::cout << msg << std::endl;
std::cout << std::endl; // Flush stdou buffer
std::cout << first << std::endl;
std::cout << second << std::endl;
std::cout <<"* " + greeting + " *" << std::endl;
std::cout << second << std::endl;
std::cout << first << std::endl;
}
|