Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <string.h>
- #include<stdio.h>
- int main (void){
- char palavras[20];
- int bola, outras;
- bola = outras=0;
- FILE *fp;
- fp= fopen("palavras.txt","r");
- if(fp == NULL){
- printf("Arquivo nao encontrado \n");
- }
- while(fgets(palavras,20,fp)!=NULL){
- if((strcmp(palavras,"bola")==0)){
- bola++;
- outras;
- }
- outras++;
- printf("%s",palavras);
- }
- printf("Quantidade de palavras \n %i",outras);
- printf("Quantidade de bola \n %i",outras);
- fclose(fp);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement