ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 10 Weeks Ago, 2 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 04 May 2017 My Price 8.00

Store the message “Hello, World!

++ Programming

Program 1

Write a program that carries out the following tasks:

Open a file with the name hello.txt.       

Store the message “Hello, World!” in the file.

Close the file.

Open the same file again.

Read the message into a string variable and print it.

 

Program 2

Write a program that reads each line in a file, reverses its characters, and writes the resulting line to another file. Suppose the user specifies input.txt and output.txt when prompted for the file names, and input.txt contains the lines

Mary had a little lamb

Its fleece was white as snow

And everywhere that Mary went

the lamb was sure to go.

After the program is finished, output.txt should contain

bmal elttil a dah yraM

wons sa etihw saw eceelf stI

tnew yraM taht erehwyreve dnA

.og ot erus saw bmal ehT

 

Program 3

Write a program that reads each line in a file, reverses its characters, and writes the resulting line to the same file. Use the following pseudocode:

While the end of the file has not been reached

pos1 = current get position

Read a line.

If the line was successfully read

pos2 = current get position

Set put position to pos1.

Write the reversed line.

Set get position to pos2.

Answers

(11)
Status NEW Posted 04 May 2017 04:05 AM My Price 8.00

-----------

Not Rated(0)