CSCI 131 Techniques of Programming--Spring 2014

    Home | | Syllabus | | Assignments | | Lectures | | Resources

    Solution to Project 0

    
    //**************************************************************************
    // artwork.cc
    //    Author:  C. Royden
    //    Date:    January 30, 2014
    //    Class:   CSCI 131 project 0, Professor Royden
    //    Purpose: Draws an ascii-art picture of a cow.
    //    Input:   (from standard input) Name of the user.
    //    Output:  (to standard output) Outputs a greeting and a picture.
    //***************************************************************************
    
    #include <iostream>                    //required io libraries
    using namespace std;
    
    
    int main(void)
    {
    	// variable declarations
    
    	string name; // variable to store the user's name
    
    	// prompt for and read in the user's name
    
    	cout << "What is your name? ";
    	cin >> name;
    
    	// print a greeting and a picture
    
    	cout << "Happy Birthday " << name << " !!! Here is a cow:" << endl;
    
    	// Note: The backslash '\' characters appearing in the picture
    	// have been "escaped" by putting an extra backslash before them.
    	// Otherwise the character following the backslash will be interpreted
    	// as a special character, such as tab '\t' or newline '\n'.
    
    	cout << "   /        \\" << endl;
    	cout << "  ||        ||" << endl;
    	cout << "   \\\\______//" << endl;
    	cout << "    | ____ |" << endl;
    	cout << "    |      |----------------------" << endl;
    	cout << "    |      |     \\           /     \\ =" << endl;
    	cout << "    | o  o |      |     _ _ /       |  \\" << endl;
    	cout << "     \\____/        \\ _ /            |   |\\" << endl;
    	cout << "       |                            |" << endl;
    	cout << "       |                            |" << endl;
    	cout << "       |                            |" << endl;
    	cout << "       |    ___________________     |" << endl;
    	cout << "       | | |                    | | |" << endl;
    	cout << "       | | |                    | | |" << endl;
    	cout << "       | | |                    | | |" << endl;
    	cout << "       | | |                    | | |" << endl;
    	cout << "       |v|v|                    |v|v|" << endl;
    
    	return 0;
    
    } // end of main()
    
    
    

    Home | | Syllabus | | Assignments | | Lectures | | Resources


    Constance Royden--croyden@mathcs.holycross.edu
    CSCI 131: Techniques of Programming
    Last Modified: February 10, 2014
    Page Expires: September 13, 2014