answer.
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
Nadusha1986 [10]
2 years ago
9

Write a program findStr.c that finds the "smallest" and "largest" in a series of words. After the user enters the words, the pro

gram will determine which words would come first and last if the words were listed in dictionary order. The program must stop accepting input when the user enters a four-letter word. Assume that no word is more than 20 letters long. An interactive session with the program might look like this: Enter word: dog Enter word: zebra Enter word: rabbit Enter word: catfish Enter word: walrus Enter word: cat Enter word: fish Smallest word: cat Largest word: zebra Hint: Use two strings named smallest_word and largest_word to keep track of the "smallest" and "largest" words entered so far. Each time the user enters a new word, use strcmp to compare it with smallest_word; if the new word is "smaller", use strcpy to save it in smallest_word. Do a similar comparison with largest_word. Use strlen to determine when the user has entered a four- letter word.

Computers and Technology
1 answer:
stich3 [128]2 years ago
6 0

Answer:

Check the explanation

Explanation:

C code:

#include<stdio.h>

#include<string.h>

#include<stdlib.h>

int main()

{

char input[21],smallest_word[21],largest_word[21];

printf("Enter Word : ");

scanf("%s",input);

strcpy(smallest_word,input);

strcpy(largest_word,input);

while(strlen(input)!=4)

{

if(strcmp(input,smallest_word)<0)

strcpy(smallest_word,input);

else if (strcmp(input,largest_word)>0)

strcpy(largest_word,input);

printf("Enter Word : ");

scanf("%s",input);

}

printf("Smallest word : %s\n",smallest_word);

printf("Largest word : %s\n",largest_word);

return 0;

}

You might be interested in
Kyle took a photograph of his sister, but he later noticed that his lens was marginally out of focus. Which tool can he use to i
Temka [501]

Answer:

Unsharp Mask tool

Explanation:

I just took the test and got it right

5 0
2 years ago
Elias wants to name his data in an excel file. Which step is incorrect?
saul85 [17]

Now let me ask this question to everyone in this arena tonight. WHO WANTS TO WALK WITH ELIAS?

3 0
2 years ago
Write a program that plays a reverse guessing game with the user. The user thinks of a number between 1 and 10, and the computer
nika2105 [10]

Answer:

  1. import random  
  2. target = 7  
  3. count = 0
  4. for i in range(100):
  5.    guess = random.randint(1,10)  
  6.    
  7.    if(guess == target):
  8.        count += 1
  9. print("Total of correct guess: " + str(count))

Explanation:

The solution is written in Python 3.

Firstly, import the random module since we are going to simulate the random guess by computer. Next, we presume user set a target number 7 (Line 3). Create a counter variable to track the number of correct guess (Line 4).

Presume the computer will attempt one hundred times of guessing and we use randint to repeatedly generate a random integer between 1 - 10 as guess number (Line 6). If the guess number is equal to the target, increment count by one (Line 8-9).

Display the total number of right guess to terminal (Line 11).  

4 0
2 years ago
Consider the following classes:
aleksandrvk [35]

Answer:

The answer is toy

Explanation:

I think toy is the odd one out

4 0
2 years ago
A colleague sent you an awesome article about using proper ergonomics while sitting at the computer. You don't have time to read
lys-0071 [83]

Answer: Select the article attachment and save it to your computer.

Explanation:

5 0
2 years ago
Other questions:
  • What is the term for a web site that uses encryption techniques to protect its data?
    12·1 answer
  • Jamie is preparing a presentation on his laptop for his college annual event. He inserts audio and video files into the presenta
    11·2 answers
  • The expression 10,785(1.0275)x represents the amount of money in an investment account with interest that compounds annually for
    14·2 answers
  • Design an algorithm for a bounded-buffer monitor in which the buffers (portions) are embedded within the monitor itself."
    10·1 answer
  • Discuss the importance of following a well-integrated change control process on IT projects. What consequences can result from n
    14·1 answer
  • A program is loaded into _________ while it is being processed on the computer and when the program is not running it is stored
    15·2 answers
  • Given num_rows and num_cols, print a list of all seats in a theater. Rows are numbered, columns lettered, as in 1A or 3E. Print
    7·1 answer
  • External network security threats can include management failure to support organization-wide security awareness, inadequate sec
    12·1 answer
  • Consider the method total below: public static int total (int result, int a, int b) {     if (a == 0)    {      if (b == 0)     
    8·1 answer
  • Even though Wordpress is basically free, what is the company trying to accomplish?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!