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
faltersainse [42]
3 years ago
15

Counting the character occurrences in a file

Computers and Technology
1 answer:
Katena32 [7]3 years ago
5 0

Answer:

hope this helps!

Explanation:

#include <iostream>

#include <fstream>

using namespace std;

void print_histogram(int counter[26])

{

   for(int i = 0; i < 26; ++i){

       cout << (char)(i+97) << " ";

       for(int j = 0; j < counter[i]; ++j){

           cout << (char)254;

       }

       cout << endl;

   }

}

int main()

{

   int counter[26] = {0};

   string filename = "data.txt";

   char byte = 0;

   // opens file in read mode

   ifstream input_file(filename);

   if (!input_file.is_open()) {

       cerr << "Could not open the file - '"

            << filename << "'" << endl;

       return EXIT_FAILURE; // exit if not opened

   }

   // reads every character from the file

   while(input_file.get(byte)){

       if(byte >= 97 && byte <= 122){

           ++counter[byte-97];

       }

   }

   print_histogram(counter); // required print histogram function

   return 0;

}

You might be interested in
Modify theme in excel
11111nata11111 [884]

Answer:

Explanation:

Theme may be explained as a group of different formatting options such as appearance, color, font size and so on, which could be applied on a workbook simultaneously (without having to manually format each change to the document one after the other.) Once a certain theme is selected, all formating options related to the theme is applied to the document. Themes are located in the page layout tab in excel. However, one can modify or edit each of the individual properties or options of a certain theme. Such that by the time, the theme modification would have been effected.

4 0
3 years ago
A group of computers that are interconnected order to share information or document is called a
Shkiper50 [21]
Group of computers that are interconnected in order to share information or documents is called <span>Computer network.



                                                            
Hope this helps.
</span>
5 0
3 years ago
Read 2 more answers
Match the items with their respective descriptions. denotes row numbers denotes cell addresses denotes worksheets denotes column
yulyashka [42]

Answer:

The following represents the row numbers: arrowRight Reset, Previous 5, Next Pretest.

And these are the cell addresses: arrowRight C5, arrowRight 1,2, 3.

These denotes worksheets: arrow Right sheet 1, sheet 2, sheet 3, Next Previous. Likes sheet 1 denotes the first sheet and so on.

And A, B, C denotes the column headers, which can be seen on the sheet at the row above the first row.  

Explanation:

The exact match is as mentioned above.

4 0
4 years ago
A network supplies programming and services to a series of local tv stations, or _____, which contract to preempt time during sp
solong [7]
It is the Affiliates. The vast majority of which are autonomously claimed, legally consent to acquire time amid determined hours for programming gave by the systems and to convey the national promoting inside the program. 
It enables site to all the more effortlessly find and take an interest in subsidiary projects which are reasonable for their site and permits sites offering member projects to contact a bigger crowd by advancing their partner programs.
6 0
4 years ago
7. Define ports including standard and<br>specialized ports. Give examples of each.​
Montano1993 [528]

Answer:

An example of a standard port is USB (universal serial bus) which connects several devices to the system unit. An example of a specialized port is Thunderbolt which is identified by Apple's MacBook Pro and provides a high-speed connection promising to replace a number of ports such as Mini Display port.

Explanation:

Please give brainlest

5 0
3 years ago
Other questions:
  • What is an example of asynchronous communication
    7·1 answer
  • The two variables causing the point of difference between the time codes are the frequency and the count
    6·1 answer
  • What are some of the other operations that might be implemented for a queue?
    14·1 answer
  • Task:create a struct that looks like:typedef struct person{ int age; double height;} Person;Create an array of Persons. Read dat
    13·1 answer
  • Instructions:Select the correct answer.
    9·1 answer
  • When performing actions between your computer and one that is infected with a virus, which of the following offers NO risk of yo
    11·2 answers
  • Write a method that accepts a string as an argument and returns a sorted string. For example, sort("acb") returns abc. Write a t
    6·1 answer
  • 11.11 LAB: Number pattern Write a recursive function called PrintNumPattern() to output the following number pattern. Given a po
    13·2 answers
  • A processor's speed is measured in megahertz (MHz), or millions of instructions per second; and gigahertz (GHz), or billions of
    9·2 answers
  • Which of the following statements are true regarding models? Select 3 options.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!