Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1- Given the availability of an ofstream object named output , and a string vari

ID: 3658053 • Letter: 1

Question

1- Given the availability of an ofstream object named output , and a string variable name tweet , write the other statements necessary to open a file named mytweet" , display the prompt tweet: and then read an entire line into tweet and then write it out to the file mytweet. (Do not define a main function.)

--------------------------------------------------------------------------------------------------------------------------

2-
Assume that a , b and c are char variables has been declared. Write some code that reads in the first character of the next line into a , the first character of the line after that into b and the first character of the line after that into c . Assume that the lines of input are under 100 characters long.

--------------------------------------------------------------------------------------------------------------------------

3-Assume that c is a char variable has been declared. Write some code that reads in the first character of the next line into c . Assume that the lines of input are under 100 characters long.

--------------------------------------------------------------------------------------------------------------------------

4-Write the definition of a function named fscopy . This function can be safely passed two fstream objects, one opened for reading, the other for writing. Assume that the input source is a text file consisting of a sequence of newline character-terminated lines. The function simply copies, line by line, the entire content of the data source associated with the first argument to the data target associated with the second argument. No value is returned.

--------------------------------------------------------------------------------------------------------------------------

5-Assume that given , middle and family are three variables of type string that have been assigned values. Write an expression whose value is a string consisting of the first character of given followed by a period followed by the first character of middle followed by a period followed by the first character of family followed by a period: in other words, the initials of the name. So if the values of these three variables were "John" "Fitzgerald" "Kennedy", then the expression's value would be "J.F.K.".

Explanation / Answer

/*you also download the text file of the answer from.......http://www.2shared.com/document/8Xb33Jv9/HelpYou.html*/ answer-1) char tweet[20]; output.open("mytweet",ios::out); cin.getline(tweet,20); fouta; cin>>b; cin>>c; answer-3) cin>>c; answer-4) void fscopy(fstream fin, fstream fout) { char text[20]; while(!fin.eof() { fin.getline(text,20); fout