Chapter 1 Example 1

//

//  main.cpp

//  Chapter1

//

//  Created by Daniel Chan on 12/14/14.

//  Copyright (c) 2014 Pookeye Inc. All rights reserved.

//

#include <iostream>

#include <string>

int main() {

    // ask for a persons name and greet the person.

    

    std::cout << “Please Enter your First Name: “;

    

    //read name

    std::string Firstname; //define the variable name

    std::cin >> Firstname; //read the name and put it into variable name

    std::cout << “Please Enter your Last Name: “;

    std::string LastName;

    std::cin >> LastName;

    

    //write a greeting

    std::cout << “Hello, “ << Firstname <<” “ << LastName << “!” << std::endl;

    

    

    return 0;

}

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s