Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <ctype.h>
- int main(int argc, char * argv[]) {
- if(argc < 2) {
- printf("Nema dovolno argumenti\n");
- return 0;
- }
- FILE * in = fopen(argv[1], "r");
- if(in == NULL) {
- printf("Ne postojat datotekite\n");
- return 0;
- }
- char niza[2000];
- int maks_golemi_bukvi = 0, maks_reden_broj = 1;
- char res[2000];
- int reden_broj = 1;
- while(fgets(niza, 80, in) != NULL) {
- int golemi_bukvi = 0;
- for(int i = 0; i < strlen(niza); i++) {
- if(isalpha(niza[i]) && isupper(niza[i])) {
- golemi_bukvi++;
- }
- }
- if(golemi_bukvi > maks_golemi_bukvi) {
- maks_golemi_bukvi = golemi_bukvi;
- maks_reden_broj = reden_broj;
- strcpy(res, niza);
- }
- reden_broj++;
- }
- printf("%d\n%s\n", maks_reden_broj, res);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment