Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <ctype.h>
- #define MAX 100
- int main ()
- {
- FILE *dat;
- int pom=100,i,j,dolzina,brojac=0,brb=0,brc=0,max=0,pom1=0,d1,suma=0;
- char red[MAX], red2[MAX],c;
- if((dat=fopen("haha1.txt", "r"))==NULL)
- {
- printf("NE");
- return -1;
- }
- while(fgets(red,MAX,dat)!=NULL)
- {
- suma=0;
- dolzina=strlen(red);
- for(i=0;i<dolzina;i++)
- {
- if(((isalnum(red[i])&& islower(red[i]))|| isspace(red[i])|| ispunct(red[i])|| isdigit(red[i])|| iscntrl(red[i])))
- {
- suma+=red[i];
- max=suma;
- }
- if(pom<max)
- {
- pom=max;
- strcpy(red2,red);
- }
- }
- }
- fclose(dat);
- printf("%d\n", suma);
- printf("%s", red2);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement