dmjio
3/17/2013 - 2:14 AM

Simple hello in C++

Simple hello in C++

#include <iostream>
#include <string>


int main(int argc, char *argv[])
{
  std::cout << "Please enter your name";
  std::string name;
  std::cin >> name;

  const std::string greeting = "Hello, " + name + "!";
  const std::string spaces (greeting.size(), ' ');
  const std::string middle = "* " + spaces + " *";
  const std::string g = "* " + greeting + " *";
  const std::string upper(middle.size(), '*');

  //print
  std::cout << upper << std::endl;
  std::cout << middle << std::endl;
  std::cout << g << std::endl;
  std::cout << middle << std::endl;
  std::cout << upper << std::endl;



  return 0;



}