Después de de nuestra prolongada recopilación de datos hemos podido solucionar este asunto que presentan ciertos los usuarios. Te brindamos la solución y esperamos servirte de mucha apoyo.
Ejemplo: #incluir
/*
Desperation: This program will have that reports how many lines, words, and characters in an input text file with more than 300 words,
and at least 3 paragraphs, and also makes a sorted list of all words found in it. You are required to provide the text file.
Write the sorted list to an output file, along with the number of times each word appeared in the input file.
For the purpose of this program, a word consists of a consecutive sequence of any characters except white space characters
Programmer: Atifa Masoudi
Programmer ID: 156308199
Date:07/09/2020
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#define MAX 1000
int main(void)
int wordcount = 0, charcount = 0;
FILE *fptr, *fptr1;
int i, len, index, isUnique;
char words[MAX][50];
char temp[50];
int t;
char word[50];
int count[MAX];
fptr = fopen("file.txt", "r");
if (fptr == NULL)
printf("Unable to open file. ");
exit(1);
for (i = 0; i<MAX;i++)count[i]= 0;index= 0;while(fscanf(fptr,"%s",word)!= EOF)len= strlen(word);if(ispunct(word[len-1]))word[len-1]='';for(inti= 0;ii++)if(word[i]> = 'A'&&word[i] <= 'Z')
word[i] = word[i] + 32;
isUnique = 1;
for (i = 0; i 0)
strcpy(temp, words[i]);
strcpy(words[i], words[j]);
strcpy(words[j], temp);
t = count[i];
count[i] = count[j];
count[j] = t;
wordcount = index;
for (int i = 0; i %d ", words[i], count[i]);
return 0;
Si aceptas, eres capaz de dejar una crónica acerca de qué le añadirías a este enunciado.
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)