1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
emmainna [20.7K]
4 years ago
6

In C++ :

Computers and Technology
1 answer:
elena-s [515]4 years ago
8 0

Answer::

//Program is written in C++ Programming Language

// Comments are used for explanatory purpose

#include

#include

#include

#include

using namespace std;

int main(){

ifstream file; // File stream object

string name; // To hold the file name

string inputLine; // To hold a line of input

int lines = 0; // Line counter

int lineNum = 1; // Line number to display

// Get the file name.

cout << "Enter the file name: ";

getline(cin, name);// Open the file.

file.open(name.c_str());// Test for errors.

if (!file){

// There was an error so display an error

// message and end the PROGRAM.

cout << "Error opening " << name << endl;

exit(EXIT_FAILURE);

}

// Read the contents of the file and display

// each line with a line number.

// Get a line from the file.

getline(file, inputLine, '\n');

while (!file.fail()){

// Display the line.

cout << setw(3) << right << lineNum<< ":" << inputLine << endl;

// Update the line DISPLAY COUNTER for the next line.

lineNum++;// Update the total line counter.

lines++;// If we've displayed the 24th line, pause the screen.

if (lines == 24){

cout << "Press ENTER to CONTINUE...";

cin.get();

lines = 0;

}

// Get a line from the file.

getline(file, inputLine, '\n');}

//Close the file.

file.close();

return 0;}

You might be interested in
Validating the results of a program is important to a. correct runtime errors b. make sure the program solves the original probl
elena-s [515]

Answer:

b. make sure the program solves the original problem

Explanation:

This is important so as to avoid logical errors. Logical errors unlike compiler or run time errors will not stop your code from compilling and executing but after your program compiles and runs, but does the wrong thing by given you unexpected results

This is the reason why validation of results after your code is completed is important in this way you are sure the program solves the original problem.

4 0
3 years ago
How to copy music from windows media player to pc?
Delvig [45]
<span><span>Click the playlist you want to export, and then click Export Playlist to File on the File menu.
</span><span>In the Save As dialog box, click the folder that contains the playlist you want to export.
</span><span>In the File name box, type a descriptive name for your playlist, and then click OK. This file is saved with a .asx file extension.</span></span>
4 0
3 years ago
To create a new folder, press ____.
finlep [7]
Hey There!

To create a new folder, press <span>Ctrl+Shift+N</span><span>

</span>
5 0
3 years ago
How does voting help in a social news site?
Inessa05 [86]
It helps spread the word about certain candidates in an upcoming election.
6 0
3 years ago
Why does my smoke detector keep beeping even after i change the battery?.
UkoKoshka [18]

Sometimes they just beep for no reason or the batteries are faulty

8 0
2 years ago
Other questions:
  • When you hack a website, do you enter in the master code in the html section code data, or the offline/online system?
    14·1 answer
  • An administrator has noticed that GPO containing new update settings has not yet applied to one of the computers on the network.
    5·1 answer
  • Universal Containers is implementing a community of High-Volume Community users. Community users should be able to see records a
    12·1 answer
  • Wide area networks are defined by their ability to
    14·2 answers
  • In regard to protective actions for explosive devices, the area where the blast originates is referred to as ___________ perimet
    8·1 answer
  • What's the average value of an ac voltage that has a maximum Peak voltage of 80 VAC
    13·1 answer
  • Self-confidence, blank, and communication are key factors to building positive relationships. Fill in the blank with a 13 letter
    5·1 answer
  • The working window of a presentation is the O outline O handout 0 notes o slide​
    5·2 answers
  • Consider the following code:
    6·1 answer
  • Which of the following statements about ip addresses is true?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!