Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <ctype.h>
- #include <string.h>
- int main(int argc, const char * argv[]) {
- if(argc < 3) {
- printf("Vlezna datoteka i izlezna treba da se vnesat kako argument\n");
- return 0;
- }
- FILE *in = fopen(argv[1], "r");
- FILE * out = fopen(argv[2], "w");
- if(in == NULL) {
- printf("Fajlot ne postoi\n");
- return 0;
- }
- if(out == NULL) {
- printf("Fajlot ne postoin\n");
- return 0;
- }
- char s[2000];
- int red = 1, brojac = 0;;
- while(fgets(s, 1000, in) != NULL) {
- int golemi_bukvi = 0;
- for(int i = 0; i < strlen(s); i++) {
- if(isalpha(s[i]) && isupper(s[i])) {
- golemi_bukvi++;
- }
- }
- if(golemi_bukvi < 5) {
- fprintf(out, "Red %d\n", red);
- brojac++;
- }
- red++;
- }
- fprintf(out, "Postojat %d takvi redovi\n", brojac);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement