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]
3 years ago
6

In C++ :

Computers and Technology
1 answer:
elena-s [515]3 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
How are some businesses capitalizing on social media at the time of someones death
stiv31 [10]
They'll post condolences messages etc which means many people will discover their business if they are looking for posts mentioning the deceased's name on social media. 
7 0
3 years ago
Give three reasons why resistors are important in a circuit.​
Zolol [24]
To reduce current flow
To adjust signal levels
To divide voltages
5 0
1 year ago
Why don’t we need to know and memorize the IP addresses for our favorite websites?
Solnce55 [7]

Because we have the domain name system (DNS). It registers friendly names, e.g., google.com that represent IP addresses. Your computer will consult a DNS service to query the IP address for a domain name you enter, and under-the-hood the connection is made to the IP address.

4 0
3 years ago
Andy accidentally saved a file in the wrong folder. What is the quickest way to move the file?
Degger [83]
C. is the easiest but if you dont know how to do it chose B
6 0
3 years ago
Advantages of machine language​
morpeh [17]

Machine Language is a language used to communicate with the Central Processing Unit (also known as the CPU)

6 0
3 years ago
Other questions:
  • Using refracted laser light to store data on a photoreceptive substrate is essentially how ___ storage works. Theoretically this
    5·1 answer
  • This program will output a right triangle based on user specified height triangle_height and symbol triangle_char. (1) The given
    9·1 answer
  • A university wants to install a client-server network. Which feature do you think is important for them as they set up the netwo
    7·1 answer
  • What is data? and types ??
    9·2 answers
  • Each row in a database is a set of unique information called a(n) (A.)table,(B.)record,(C.)object,(D.)field
    12·2 answers
  • write a program that asks the user to enter a positive integer, then prints a list of all positive integers that divide that num
    6·1 answer
  • Each time that you access files on a disk, the monitor blinks or goes blank for several seconds. What might be the source of the
    6·1 answer
  • Convert the decimal integer, 353.87510 to each of these forms:
    9·1 answer
  • Do you guys answer questions about cyber security?
    10·1 answer
  • For a certain company, the cost function for producing x items is C(x)=50x+100 and the revenue function for selling x items is R
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!