Last active
February 28, 2018 19:03
-
-
Save m0hmad/caa0fa896fd02b5152fcfc7dc698b58b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* chitcom: | |
* getMsgPrice(int *a, int *b) | |
* a - price | |
* b - messeg | |
*/ | |
#include <stdio.h> | |
#include <string.h> | |
int getMsgPrice( char *a, char *b ) | |
{ | |
int count; | |
count = 0; | |
int j, i; | |
for ( i = 0; i < strlen(a); i++ ) { | |
if ( a[i] == -47 ) { continue; } | |
if ( a[i] == -48 ) { continue; } | |
for ( j = 0; j < strlen(b); j++ ) { | |
if ( b[j] == -47 ) { continue; } | |
if ( b[j] == -48 ) { continue; } | |
if ( a[i] == b[j] ) | |
count++; | |
} | |
} | |
return count; | |
} | |
int main( int argc, char *argv[] ) | |
{ | |
if ( argc < 3 ) { | |
printf( "Error Input: no arguments\n" ); | |
return 1; | |
} | |
printf( "%d\n", getMsgPrice( argv[1], argv[2] ) ); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment