CSCI 1300 - Programming Assignment 2
Text Translation
Due Tuesday, Sep 17 at 9:30am


Homework Policy [CAUTION!]
Please read before submitting:
For this assignment, you may consult with other students and look at their work if it will help you understand. For this assignment, you may even work in groups and trade solutions back and forth provided that you acknowledge your entire group in a comment at the top of the program.

We will have other assignments that you will be asked to do entirely on your own.


Text Translation Preliminaries

The purpose of Assignment 2 is to make sure that you know how to use a for-loop in a small program. I got the idea for this program when I was setting up our class message board. I wanted to give a login to all the students in the class using the login names, email address and passwords that you'd already given to Dora. Dora stores all that information in a file with two lines for each student. For example, a student with the login name llong and an e-mail address of Lazurus.Long@dora.milkyway.com might have these two lines in the file:
llong.EMAIL: Lazurus.Long@dora.milkyway.com
llong.ENCRYPTED PASSWORD: askjheuus
The string askjheuus is an encrypted version of this student's password.

When I was setting up the message board, I needed to create a new file that had this same information for each student, but in a different format. In the new file, each student has just one line of information, consisting of the login name, the e-mail address, and the encrypted password, with a single space between each pair of items. So, our imaginary student would have just one line in the new file, looking like this:

llong Lazurus.Long@dora.milkyway.com askjheuus

The Assignment

Write a program that reads a single non-negative integer N from the keyboard, which could be as large as 2,000,000,000. After reading this number, the program then reads exactly N pairs of lines. Each pair of lines has a student's login name (which is guaranteed to be all lowercase letters), e-mail address and encrypted password in the two-line Dora format shown above. When each pair of lines is read, the program prints a single line of output containing the same login name, e-mail address, and encrypted password. So, there will be a total of N lines of output.

Note:The program that you write will read all of it's information from the keyboard (cin) and print all of its information to the screen (cout). The only output will be the N lines of information. There should not be any other output. For example, there will not be any messages asking the user to enter the information. The reason for writing the program in this way is so that it can later be used with a file that contains the input information. Later it will also use a file to print the output information. But for now, just use cin and cout.

There are two operations, cin.peek( ) and cin.ignore( ) that you'll need to use in this assignment. The operations are not discussed in the reading, but I will discuss them in class.

This program is essentially what I wrote to transfer your logins from Dora to the message board. The only differences are that I also transferred your first name and that I set things up so that the input and output came from files instead of from the console. We'll see how to do file input/output before the end of the semester, but using the console will do for now.

Documentation.

/*****************************************************************
* The program must have a comment at the top, in this exact form.
* The comment must contain the same items as Assignment 1A.
*****************************************************************/

Check that the program compiles and runs correctly. Submit the program to Dora. She won't do any checking on this one, so make sure that you have completely tested things before submission.