Test 1, CSCI 130, Fall 2011


  1. [4 points] Algorithms
  2. [4 points] Problem Solving: Name and Describe two problem solving strategies described in the book.
  3. [6 points] Identifier
  4. [6 points] Variables
  5. [6 points] Additional programming constructs.
  6. [4 points]getline
  7. [4 points] Describe each of the following programming tools:

  8. [6 points] Comments
  9. [10 points] Give the full c++ code for a program which asks the user for their first and last names, then prints the message Hello firstname lastname!, where firstname and lastname are the input supplied by the user.

#include <iostream>
#include <string>

using namespace std;

const string TOP_LINE = "+=+=+=+=+=+=+=+=+";

int main () {
   string userDay;

   cout << "Enter your favorite day of the week => ";
   getline(cin, userDay);
   cout < <
   cout < TOP_LINE << endl;
   cout << "+" << userDay << "+" << endl;
   cout < TOP_LINE << endl;

   return 0;
}