Name: ____________________________________________________ Alpha: _____________________

Describe help received: _________________________________________________________________

  1. [12pts] Consider the following code snippet:
    void foo(int a, int& b);
    string bar(double k, string s);
    int i, j, k;
    double x, y, z;
    string u, v, w;
    
    For the functions calls below, circle only the ones that would be OK.
    a. foo(3,4)          b. foo(i,j)      c. foo(i,j+k)      d. foo('a',i)       e. foo("a",i)
    
    f. bar(3.0,4.0)      g. bar(x,u)      h. bar(x,u+v)      i. bar(a,v)         j. bar(x+y,"a")
    

  1. [88pts] Write a program (download hw.cpp) that will read a list of strings either from the terminal or from a file and prints the strings in reverse order.

    A typical run of your program might look like this (using data.txt) :

    ~/$ ./hw
    Source: cin
    N = 5
    hello
    world 
    ic210
    is 
    cool  
    
    Strings in reverse order:
    cool
    is 
    ic210
    world 
    hello
    
    ~/$ ./hw
    Source: data.txt
    
    Strings in reverse order:
    strings
    of
    list
    a
    read
    will
    that
    )
    hw.cpp
    download
    (
    program
    a
    Write
    

    Requirement.

    Turn In the codeprint of your source code.

    Submit:

     ~/bin/submit -c=IC210 -p=hw24 hw.cpp