SHOW:
|
|
- or go back to the newest paste.
| 1 | #include <stdio.h> | |
| 2 | - | #include <ctype.h> |
| 2 | + | #include <time.h> |
| 3 | - | #define KONEC ".,:;?!\n\t" |
| 3 | + | #include <stdlib.h> |
| 4 | - | #define N 1024 |
| 4 | + | #include <math.h> |
| 5 | #define M 5 | |
| 6 | - | int Isupper(char *s) |
| 6 | + | #define N 7 |
| 7 | #define A -50 | |
| 8 | - | int i,count=0; |
| 8 | + | #define B 50 |
| 9 | - | for(i = 0 ; s[i] != '\0';i++) |
| 9 | + | |
| 10 | - | if(isupper(s[i])) |
| 10 | + | void Init(int a[][N],int m , int n) |
| 11 | - | count++; |
| 11 | + | |
| 12 | - | return count; |
| 12 | + | |
| 13 | for(i = 0 ; i < m ; i++) | |
| 14 | - | int Isdigit(char *s) |
| 14 | + | for(j = 0 ; j < n ; j++) |
| 15 | a[i][j]=A+rand()%(B-A+1); | |
| 16 | - | int i,count=0; |
| 16 | + | |
| 17 | - | for(i = 0 ; s[i] != '\0';i++) |
| 17 | + | void Print(int a[][N],int m,int n) |
| 18 | - | if(isdigit(s[i])) |
| 18 | + | |
| 19 | - | count++; |
| 19 | + | |
| 20 | - | return count; |
| 20 | + | for(i = 0 ; i < m; i++) |
| 21 | {
| |
| 22 | - | int Isalpha(char *s) |
| 22 | + | for(j = 0 ; j < n ; j++) |
| 23 | printf("%4d",a[i][j]);
| |
| 24 | - | int i,count=0; |
| 24 | + | printf("\n");
|
| 25 | - | for(i = 0 ; s[i] != '\0';i++) |
| 25 | + | |
| 26 | - | if(isalpha(s[i])) |
| 26 | + | printf("\n");
|
| 27 | - | count++; |
| 27 | + | |
| 28 | - | return count; |
| 28 | + | int Prostoe(int a) |
| 29 | {
| |
| 30 | - | void Del(char *s) |
| 30 | + | a=abs(a); |
| 31 | ||
| 32 | if (a==2) | |
| 33 | - | char buf; |
| 33 | + | return 1; |
| 34 | - | for( i = 0 ; s[i] !='\0'; i++) |
| 34 | + | if (a==0 || a==1 || a%2==0) |
| 35 | - | if(s[i]=='A' || s[i]=='E' || s[i]=='I' || s[i]=='O' || s[i]=='U') |
| 35 | + | return 0; |
| 36 | int i=3; | |
| 37 | - | for(j=i;s[j+1] != '\0';j++) |
| 37 | + | while(i <= a/2 && a%i != 0) |
| 38 | i+=2; | |
| 39 | - | buf=s[j]; |
| 39 | + | return i>a/2; |
| 40 | - | s[j]=s[j+1]; |
| 40 | + | |
| 41 | - | s[j+1]=buf; |
| 41 | + | int CountStr(int a[][N],int m,int n) |
| 42 | {
| |
| 43 | - | s[j]='\0'; |
| 43 | + | int i,j,count=0,flag=0,max=0,buf=0; |
| 44 | for( i = 0 ; i < m; i++) | |
| 45 | - | puts(s); |
| 45 | + | |
| 46 | for(j = 0 ; j < n ; j++) | |
| 47 | if(Prostoe(a[i][j])==1) | |
| 48 | {
| |
| 49 | - | char s[N]; |
| 49 | + | printf("==%4d",a[i][j]);
|
| 50 | - | char *word,*buf="\0"; |
| 50 | + | count++; |
| 51 | - | int i,j,flag[256]={0},k=0,max,end;
|
| 51 | + | flag=1; |
| 52 | - | fgets(s,N,stdin); |
| 52 | + | |
| 53 | - | for(i = 0; KONEC[i]; i++) |
| 53 | + | if(count>=max) |
| 54 | - | flag[KONEC[i]]=1; |
| 54 | + | |
| 55 | - | for( i = 0 ; s[i] && flag[s[i]]; i++) |
| 55 | + | max=count; |
| 56 | - | ; |
| 56 | + | buf=i; |
| 57 | - | while(s[i]) |
| 57 | + | |
| 58 | count=0; | |
| 59 | - | word = &s[i]; //s + i; |
| 59 | + | |
| 60 | - | while( s[i] && !flag[s[i]]) |
| 60 | + | if (flag==0) |
| 61 | - | i++; |
| 61 | + | return -1; |
| 62 | - | j = i; |
| 62 | + | if (flag) |
| 63 | - | while( s[i] && flag[s[i]]) |
| 63 | + | return buf; |
| 64 | - | i++; |
| 64 | + | |
| 65 | - | s[j] = '\0'; |
| 65 | + | |
| 66 | - | end=strlen(word); //razmer stroki do \0 |
| 66 | + | |
| 67 | - | if(Isdigit(word)==end) // Slovo iz cifr |
| 67 | + | int a[M][N],b[M],buf; |
| 68 | srand(time(NULL));; | |
| 69 | - | printf("\nSlovo TOKO IZ CIFR\n");
|
| 69 | + | Init(a,M,N); |
| 70 | - | puts(word); |
| 70 | + | Print(a,M,N); |
| 71 | buf=CountStr(a,M,N); | |
| 72 | - | |
| 72 | + | if(buf==-1) |
| 73 | - | |
| 73 | + | printf("Net Stroki s prostimi 4islami");
|
| 74 | - | if(Isalpha(word)==end) //slovo iz bukv |
| 74 | + | else |
| 75 | printf("\nNomer Stroki=%d\n",buf);
| |
| 76 | - | printf("\nSLovo TOKO IZ BUKV\n");
|
| 76 | + | |
| 77 | - | puts(word); |
| 77 | + |