Question

Write a program in C language that gets a list of names from user. The list...

Write a program in C language that gets a list of names from user. The list ends when the user gives ‘quit’. The program should then print all the names provided by the user and the frequency of each name. Assume each name is at most of size 100 characters.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include<conio.h>
#include <stdio.h>

void main()
{
    char name[1000][1000];
    int count=0;
    do
    {
        count++; //count is used to count the number of times user has enter teh name
    printf("Enter the name \n");
    scanf("%s",name[count]);   //saving the name in a character array
    }while(strcmp(name[count],"quit") != 0);   // strcmp is used to compare two strings
    for(int i=1;i<count;i++) // we have already counted how many times the user is enterng the name
    {
        printf("%s\n",name[i]);
    }
}
   
Run O DebugStop Share H save Beautify Language C Enter the name rony Enter the name ohn Enter the name uit rony ohn .Program

Add a comment
Know the answer?
Add Answer to:
Write a program in C language that gets a list of names from user. The list...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • this assignment should be delivered in C language Program 4 will prompt the user for one...

    this assignment should be delivered in C language Program 4 will prompt the user for one or two token, space delimited, inputs of at most 20 characters. If the user provides more than 20 characters before a newline is reached print the provided error message. If the number of tokens is incorrect, print the appropriate error message. If the input is correct, print the appropriate token types. Prompt the user for input (and provide output) until the user provides a...

  • 1. Write a program to input a list of names (strings) from the user and store...

    1. Write a program to input a list of names (strings) from the user and store them in an ArrayList. The input can be terminated by entering the empty string or by entering the string “quit”. 2. Add further functionality to your program so that it searches the ArrayList to find the first string and the last string according to dictionary ordering and then prints out these strings (names). Do this exercise without sorting the names in the ArrayList. For...

  • Write a C program that prompts the user for an input string with all lowercase letters....

    Write a C program that prompts the user for an input string with all lowercase letters. Your program should then sort the characters in the string and print the sorted string. Assume that the string contains no spaces and has at most 30 lowercase characters. Your program should loop continually until the user enters “q” to quit.

  • Write a program that prompts the user to enter a list of names. Each person's name...

    Write a program that prompts the user to enter a list of names. Each person's name is separated from the next by a semi-colon and a space (: and the names are entered lastName, firstName (i.e. separated by ',). Your program should then print out the names, one per line, with the first names first followed by the last names. A sample run of your program should look like Please enter your list of names: Epstein, Susan; St. John, Katherine;...

  • Write a Python program that keeps reading in names from the user, until the user enters...

    Write a Python program that keeps reading in names from the user, until the user enters 0. Once the user enters 0, you should print out all the information that was entered by the user. Use this case to test your program: Input: John Marcel Daisy Samantha Nelson Deborah 0 ================ Output: John Marcel Daisy 25 Samantha Nelson Deborah Hints: Create an array Names to hold the input names. Use the Names.append(x) function to add a new name to the...

  • LANGUAGE = C i. Write a program that takes int numbers from user until user gives...

    LANGUAGE = C i. Write a program that takes int numbers from user until user gives a sentinel value (loop terminating condition). Sort the numbers in ascending order using Insertion sort method. Sorting part should be done in different function named insertionSort(). Your code should count the number of swaps required to sort the numbers. Print the sorted list and total number of swaps that was required to sort those numbers. (4 marks) ii. In this part take another number...

  • IN C language Write a C program that prompts the user to enter a line of...

    IN C language Write a C program that prompts the user to enter a line of text on the keyboard then echoes the entire line. The program should continue echoing each line until the user responds to the prompt by not entering any text and hitting the return key. Your program should have two functions, writeStr andcreadLn, in addition to the main function. The text string itself should be stored in a char array in main. Both functions should operate...

  • *Coral Language* Write a program that first gets a list of six integers from input. The first five values are the intege...

    *Coral Language* Write a program that first gets a list of six integers from input. The first five values are the integer list. The last value is the upper threshold. Then output all integers less than or equal to the threshold value. Ex: If the input is 50 60 140 200 75 100, the output is: 50 60 75 For coding simplicity, follow every output value by a space, including the last one. Such functionality is common on sites like...

  • write a program that gets a list of double numbers from user and output the largest...

    write a program that gets a list of double numbers from user and output the largest and smallest one by using array intro Computer science problem InFocus Name Cortlyn CUNYID 123 JseR jeno5678 Psswot C:)2315 Cs coubles User hoje56 7 Password Csla3u56 WR user and om CS I fall one wite tha apeatal holaces Cand vetun ae out Put

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT