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
Write a java program that will print out the following pattern 1 12 123 1234 12345
Ilya [14]

Answer:

public class Main {

  public static void main(String[] args)

{

  int n,m;

  int k=5;

  for(n=1;n<=k;n++)

  {

for(m=1;m<=n;m++)

  System.out.print(m);

   System.out.print(" ");

   }

}

}

Explanation:

The solution to this problem is the use of nested loops of an inner and outer loop to generate a half pyramid of numbers, but displayed on the same line so we have a sequence 1 12 123 1234 12345. The outer loop iterates for n=1 to n<=5 and the inner loop that has the print statement prints the integers from for m = 1 to m<=n.

Note that the value k = 5 is hard coded which in some sense is the number of rows, that is the length of iteration of the outer loop.

5 0
2 years ago
Anna bought a box of blueberries for £7. She used 700 grams for a cheesecake and she has 450 grams left. How much did the bluebe
xxTIMURxx [149]

0.61 (rounded up)

Explanation:

You add both 700 and 450 which will give you 1150g

You then divide 1150 by 100 which gives you 11.5

Then divide 7 by 11.5 which will give you 0.61 as cost of every 100 grams

8 0
2 years ago
A workgroup database is a(n) _____ database
Step2247 [10]
It is a shared database
8 0
2 years ago
I can't imagine any reason _______ he should have behaved in such an extraordinary way. for that why how
professor190 [17]
<span>I can't imagine any reason "why" he should have behaved in such an extraordinary way. If we were to use "how" in that sentence it would contradict the context. We are obviously talking about a situation that has happened so we know that "he" has in fact acted in an extraordinary way but we don't know "why" he acted that way. Therefore "why" is the correct term to use.</span>
4 0
2 years ago
NTDS Quotas store NT Directory Service quota information that limits the number of Active Directory objects a user, group, compu
Anna35 [415]

Answer:

The anwer is advanced feature folder

Explanation:

Because NTDS QUOTAS is an advanced feature folder that stores NTDS quota information that limits the number of Active Directory objects a user, group, computer, or service can create.

3 0
2 years ago
Other questions:
  • What is the 5 basic steps of computer programing?
    6·1 answer
  • Which of the following is true about simulation games? A. Simulation games involve competing in a sport against other players. B
    10·2 answers
  • Which of the given information should you keep confidential and why? a. You see a memo with the name of your coworker, who will
    13·2 answers
  • ___________ device that uses a light source to read characters, marks, and codes and then converts them into digital data that a
    11·1 answer
  • In this lab, you use the pseudocode in figure below to add code to a partially created Python program. When completed, college a
    11·1 answer
  • In this assignment, you are provided with almost-working code that establishes a TCP socket connection over the INET domain (tho
    11·1 answer
  • In this problem, we want to compare the computational performance of symmetric and asymmetric algorithms. Assume a fast public-k
    11·1 answer
  • If a class has member variables that are pointers, you must ensure that you implement ____.
    6·1 answer
  • Stan’s assignment is to print a three-dimensional image on a piece of paper. Which printing technique should he use?
    14·2 answers
  • Write an expression that will cause the following code to print "I am a teenager" if the value of userAge is less than 20. Zyboo
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!