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
QveST [7]
2 years ago
7

In c please

Computers and Technology
1 answer:
Paraphin [41]2 years ago
5 0

Answer:

#include <stdio.h>

#include <ctype.h>

void printHistogram(int counters[]) {

   int largest = 0;

   int row,i;

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

       if (counters[i] > largest) {

           largest = counters[i];

       }

   }

   for (row = largest; row > 0; row--) {

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

           if (counters[i] >= row) {

               putchar(254);

           }

           else {

               putchar(32);

           }

           putchar(32);

       }

       putchar('\n');

   }

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

       putchar('a' + i);

       putchar(32);

   }

}

int main() {

   int counters[26] = { 0 };

   int i;

   char c;

   FILE* f;

   fopen_s(&f, "story.txt", "r");

   while (!feof(f)) {

       c = tolower(fgetc(f));

       if (c >= 'a' && c <= 'z') {

           counters[c-'a']++;

       }

   }

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

       printf("%c was used %d times.\n", 'a'+i, counters[i]);

   }

   printf("\nHere is a histogram:\n");

   printHistogram(counters);

}

You might be interested in
When one method calls another, which of the following statements are true?
jonny [76]

Answer:

I. The class methods and instance methods of one class may call the public class methods of another class using dot notation and referencing the name of the other class.

Explanation:

Private methods are being accessed from only within the class or scope specified. No other means of accessibility is possible, and even through inheritance. And instance methods can never call without using dot notation, any of the class method of the same class. Hence second and third options are not correct. And the class method and the instance methods of one class may call the public class methods of another class using the dot notation and referencing the name of the other class. Hence, the correct option is the first one.

3 0
3 years ago
If Scheme were a pure functional language, could it include DISPLAY ? Why or why not?​
VARVARA [1.3K]

Answer:

When Scheme is a pure functional language, it cannot include the function DISPLAY. Since the pure functional languages will return the same value whenever the same expression is evaluated, and the DISPLAY would be the output and thus it cannot be part of the purely functional language. Thus in the pure functional language we can evaluate the expressions with the same arguments and it returns the same value since there is no state to change.

Explanation:

4 0
2 years ago
Terrell is studying abroad in France for the semester. He would like to be able to use the French keyboard on his laptop and vie
Murrr4er [49]

Answer:

Terrell can change the keyboard layout by typing "keyboard options" in start menu search box of windows, then open the language option and choose the french layout or language. Terrell can change the Date and time or Region from control panel or by right click on the time in taskbar, then goto adjust date/time, there he will find options for "date and time" and "Region", which can be modified as per requirement.

6 0
3 years ago
Read 2 more answers
In what respects does a UML state diagram differ from a state transition diagram?
musickatia [10]

Answer: The difference between the UML state diagram and state transition diagram are as follow:-

  • State-transition diagrams display the states of the object where the change takes place whereas the UML(Unified modeling language) state diagrams are representation of parts of system at certain time instance.
  • State-transition diagram requires the condition to be accomplished before the transition happens whereas the dynamic behavior of the states are expressed by transitions in UML state diagrams.

5 0
3 years ago
Write a loop that displays your name 10 times. 2. Write a loop that displays all the odd numbers from 1 through 49. 3. Write a l
irakobra [83]

Answer:

The program in Python is as follows:

#1

for i in range(10):

   print("MrRoyal",end=" ")

print()    

#2

for i in range(1,50,2):

   print(i,end=" ")

print()

#3

for i in range(0,101,5):

   print(i,end=" ")

print()

#4

i = 1

while i <=10:

   print(i,end =" ")

   i+=1

#5

myfile = open("People.txt", "r")

eachLine = myfile.readline()

while eachLine:

   print(eachLine)

   eachLine = myfile.readline()

myfile.close()

Explanation:

The program in Python is as follows:

Program #1

This iterates from 1 to 10

for i in range(10):

This prints the name for each iteration [modify to your name]

   print("MrRoyal",end=" ")

This prints a new line

print()    

Program #2

This iterates from 1 to 49 with an increment of 2

for i in range(1,50,2):

This prints the odd numbers in the above range

   print(i,end=" ")

This prints a new line

print()

Program #3

This iterates from 0 to 100 with a step of 5

for i in range(0,101,5):

This prints every 5th number

   print(i,end=" ")

Print a new line

print()

Program #4

This initializes the number to 1

i = 1

This opens the file in an append mode

f = open("myfile.txt", "a")

This loop is repeated from 1 to 10

while i <=10:

This writes each number to the file

   f.write(str(i))

Increment the number by 1

   i+=1

Close the file

f.close()

Program #5

This opens the file in a read mode

myfile = open("People.txt", "r")

This reads each line

eachLine = myfile.readline()

This loop is repeated for every line

while eachLine:

Print the content on the line

   print(eachLine)

Read another line

   eachLine = myfile.readline()

Close the file

myfile.close()

3 0
3 years ago
Other questions:
  • Remy’s manager has asked him to change the background color scheme from reds to blues in the standard template the company uses
    15·2 answers
  • Match the fallacy with its name. Being a speaker of Spanish, I'm also great at speaking Italian.
    10·1 answer
  • A personal identification number (PIN) that opens a certain lock consists of a sequence of 3 different digits from 0 through 9,
    7·1 answer
  • During a night flight, you observe a steady red light and a flashing red light ahead and at the same altitude. What is the gener
    11·1 answer
  • A selected graphic appears surrounded by a(n) ______, which has small squares and circles around its edges.
    7·1 answer
  • Being able to express your thoughts in an email is a primary technology skill. true or false.
    9·2 answers
  • In addition to explaining the paper’s topic, a thesis statement provides instructions on how to read the paper. explains why the
    10·2 answers
  • The average numbers of shares a piece of content receives is known as its:
    7·1 answer
  • Which of the following statements is TRUE? A. A name error occurs if the variable is referenced before it is declared. B. A name
    12·1 answer
  • Which language should you use to add functionality to web pages.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!