Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Array non repeated alphabets
//gcc 4.9.3 #include <stdio.h> #include <stdlib.h> void input(int *p,int n) { int i; srand(getpid()); for(i=0;i<n;i++) { p[i]=rand()%26+65; if(ifRepeated(p,i)) { i--; } } } void print(int *p,int n) { int i; printf("**the array***\n"); for(i=0;i<n;i++) printf("p[%d]=%c\n",i,p[i]); } void vowles(int *p,int n) { int i,ch; printf("***VOWLES***\n"); for(i=0;i<n;i++) { switch(p[i]) { case 'A':printf("p[%d]=%c\n",i,p[i]); break; case 'E':printf("p[%d]=%c\n",i,p[i]); break; case 'I':printf("p[%d]=%c\n",i,p[i]); break; case 'O':printf("p[%d]=%c\n",i,p[i]); break; case 'U':printf("p[%d]=%c\n",i,p[i]); break; } } } int ifRepeated(int *p,int i) { int j=i-1; while(j>=0) { if(p[j]==p[i]) return 1; j--; } return 0; } main() { int a[20]; int n; n=sizeof(a)/sizeof(a[0]); input(a,n); print(a,n); vowles(a,n); }
run
|
edit
|
history
|
help
0
good Job
String copy
Assignment 8
str_ptr_to_fumc_v2
G
PREGUNTA 10 CADENAS
co_4
piesa perdida
FUNTION 2
bitwise_operation__end-of-class