Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <ctype.h>
- int main(int argc, char * argv[]) {
- if(argc < 2) {
- printf("Vlezna datoteka se vnesuva preku komandna linija\n");
- return 0;
- }
- FILE * in = fopen(argv[1], "r");
- if(in == NULL) {
- printf("Vnesovte ne validna vlezna datoteka\n");
- return 0;
- }
- char niza[2000];
- char c;
- int j = 0;
- while((c = fgetc(in)) != EOF) {
- if(isalnum(c)) {
- niza[j] = c;
- j++;
- }
- else {
- int cifri = 0, bukvi = 0;
- for(int i = 0; i < j; i++) {
- if(isdigit(niza[i])) {
- cifri++;
- }
- if(isalpha(niza[i])) {
- bukvi++;
- }
- }
- if(cifri >= 2 && bukvi >= 1) {
- for(int i = 0; i < j; i++) {
- printf("%c", niza[i]);
- }
- printf("\n");
- }
- j = 0;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement