void enc_change(char word[LENGTH], int size, int game){ int condition=TRUE, letter, i; char c; do { if (game == 0){ letter = rand()%size; /* pick random letter*/ if(isvowel(word[letter])){ /* see if the letter is a enc_vowel*/ if((c=enc_vowel()) != word[letter]){ /* see if the enc_vowel is different of the on I had */ for (i=0; i<size; i++){ if (word[i] == word[letter]){ /* I want to check if there are more */ word[i] = c; /* than one same letters in my initial word */ condition = FALSE; } } } } } else if (game == 1 ){ letter = rand()%size; /* same here */ if(isvowel(word[letter]) == 0){ if((c=enc_constant()) != word[letter]){ for (i=0; i<size; i++){ if (word[i] == word[letter]){ word[i] = c; condition = FALSE; } } } } } } while (condition); }
int iscon(char a,char b,char c){ int r; r=isvowel(a)+isvowel(b)+isvowel(c); if(r==0||r==3) return 1; return 0; }
char *reverseVowels(char *s) { int l = 0, r = strlen(s) - 1; char c; while (l < r) { while (l < r && !isvowel(s[l])) l++; while (r > l && !isvowel(s[r])) r--; c = s[l]; s[l] = s[r]; s[r] = c; l++,r--; } return(s); }
bool can_pkill( char_data* ch, char_data* victim, bool msg ) { room_data* room = Room( ch->array->where ); if( room != NULL ) { if( is_set( &room->room_flags, RFLAG_ARENA ) ) return TRUE; if( is_set( &room->room_flags, RFLAG_NO_PKILL ) ) { if( msg ) send( ch, "You can't kill players here.\r\n" ); return FALSE; } } if( victim == NULL ) return TRUE; if( ch->shdata->race <= RACE_LIZARD && victim->shdata->race <= RACE_LIZARD ) { if( msg ) { const char* race = plyr_race_table[ victim->shdata->race ].name; send( ch, "You would never kill a%s %s.\r\n", isvowel( *race ) ? "n" : "", race ); } return FALSE; } return TRUE; }
const char* obj_clss_data :: Name( ) { char* tmp; const char* singular; tmp = static_string( ); strcpy( tmp, is_set( extra_flags, OFLAG_THE ) ? "the " : "an " ); if( prefix_singular != empty_string ) sprintf( tmp+strlen( tmp ), "%s ", prefix_singular ); singular = seperate( this->singular, TRUE ); switch( *after ) { case '\0' : strcat( tmp, singular ); break; case '+' : sprintf( tmp+strlen( tmp ), "%s %s", singular, &after[1] ); break; default : sprintf( tmp+strlen( tmp ), "%s%s%s", after, *after == '\0' ? "" : " ", singular ); break; } if( *tmp == 't' || isvowel( tmp[3] ) ) return tmp; tmp[1] = 'a'; return &tmp[1]; }
void print_if_good (int maxNumConsonant, char word[], int *level) { int i; int numVowel = 0; /*This loop counts the number of vowel*/ for (i = 0; i < 7;i++) { if (isvowel(word[i])) { numVowel++; } } /*This loop prints the word if there is maxNumConsonant or fewer consonants*/ if ((7 - numVowel) <= maxNumConsonant) { printf ("%s ",word); /*Every time we print a word out, we add 1 to the value of level.*/ *level = *level + 1; /*Every seventh word we print out, we add a carriage return to make the format nice*/ if ((*level)%7 == 0) { putchar ('\n'); } } }
bool get_items() { List<Object> &os = game.map.at(game.player.x, game.player.y)->objects; if (os.empty()) return false; Object *k; while ((k = os.pop())) { const char *name = k->desc()->name; if (k->quantity == 1) { const char *a_an = isvowel(name[0]) ? "n" : ""; iprintf("You pick up a%s %s.\n", a_an, name); } else { if (k->desc()->plural) { iprintf("You pick up %d %s.\n", k->quantity, k->desc()->plural); } else { iprintf("You pick up %d %ss.\n", k->quantity, name); } } // go through the bag to see if we can stack. stack_item_push(game.player.bag, k); } game.cooldown += 4; return true; }
void vowel_quash(char data[10][7], int n) { int i; for (i=0; i<=strlen(data[n]); i=i+1) if (isvowel(data[n][i])) data[n][i] = '-'; }
// this is function ensures vowels change only to vowels and likewise with consonants. // currently unused. void enc_shiftLetter(cell grid[H][W], int y, int x){ entity *e; e = grid[y][x].background->pointsto; if (isvowel(e->type)){ do { enc_updateLetter(grid, y, x); e = grid[y][x].background->pointsto; } while(isvowel(e->type) == FALSE); } else if ( ! (isvowel(e->type))) { do { enc_updateLetter(grid, y, x); e = grid[y][x].background->pointsto; } while(isvowel(e->type) == TRUE); } }
string reverseVowels(string s) { for (int i = 0, j = s.size() - 1; i < j; ) { if (!isvowel(s[i])) { i++; continue; } if (!isvowel(s[j])) { j--; continue; } std::swap(s[i], s[j]); i++; j--; } return s; }
// take all vowels out of string void disemvowel(string& s) { string s_novow; for (int i = 0; i<s.size(); ++i) { if (!isvowel(s[i])) s_novow.push_back(s[i]); } s = s_novow; }
int count_vowels(char data[10][7], int n) { int i,j,vc=0; for (i=0; i<=n; i=i+1) for (j=0; j<strlen(data[i]); j=j+1) if (isvowel(data[i][j])) vc = vc + 1; return vc; }
void create_cv_signature(char *ptr, phone_type *arr) { phone_type *arr_next; arr_next = arr; while (*ptr) { *arr_next++ = isvowel(*ptr) ? 'v' : 'c'; ptr = add_1_phone(ptr); } *arr_next = 0; }
int solve(int i, int vwls, int cons) { if(vwls == 3 || cons == 5) return 1; if(!str[i]) return 2; if(dp[i][vwls][cons] != -1) return dp[i][vwls][cons]; if(str[i] == '?') dp[i][vwls][cons] = solve(i + 1, vwls + 1, 0) | solve(i + 1, 0, cons + 1); else if(isvowel(str[i])) dp[i][vwls][cons] = solve(i + 1, vwls + 1, 0); else dp[i][vwls][cons] = solve(i + 1, 0, cons + 1); return dp[i][vwls][cons]; }
void rm_vowels(char *from) { char *to = from; while (*from != '\0') if (isvowel(*from)) from++; else *to++ = *from++; *to = '\0'; }
int main(){ char a[21]; int i,vowel,three,two; while(scanf("%s",a)!=EOF){ if(!strcmp(a,"end")) break; vowel=three=two=0; for(i=0;a[i]!='\0';i++){ if(isvowel(a[i])){ vowel=1; if((i+2)<strlen(a)&&isvowel(a[i+1])&&isvowel(a[i+2])) three=1; } else if((i+2)<strlen(a)&&!isvowel(a[i+1])&&!isvowel(a[i+2])) three=1; if(a[i]!='e'&&a[i]!='o'&&a[i+1]!='\0'&&a[i+1]==a[i]) two=1; } printf("<%s> is %sacceptable.\n",a,(vowel&&!three&&!two)?"":"not "); } return 0; }
/*------------------------------------------------- syll_count ----- | Function syll_count | | Purpose: Counts syllables in a word. Dipthongs (ie., | aa, ae, ee, etc...) all count as one syllable. Silent | syllables do not count. | | | Parameters: word (IN) -- String that is a word. Doesn't have to | be a word, but you want it to be. | | | Returns: Number of syllables in the word as an int *-------------------------------------------------------------------*/ int syll_count(char * word) { int retval = 0; int len = strlen(word); char last = '\0'; int i = 0; while (word[i] != '\0') { char c = tolower(word[i]); if (isvowel(c) && !isvowel(last) && !(i == len - 1 && c == 'e')) { debug("%c is a vowel", c); retval++; } else { debug("%c is not a vowel", word[i]); } last = c; i++; } return retval; }
const char* level_name( int i ) { char* tmp = static_string( ); if( i < LEVEL_AVATAR ) sprintf( tmp, "level %d", i ); else sprintf( tmp, "a%s %s", isvowel( *imm_title[ i-LEVEL_AVATAR ] ) ? "n" : "", imm_title[ i-LEVEL_AVATAR ] ); return tmp; }
/* Print description */ void tdesc(struct tobj *t, int which){ if(t->article != OWDESC){ printf("%s", t->article); } if(which & DESC){ if(t->article == OWDESC){ printf("a"); } int adj = 0; /* Adjectives based off state */ if(t->state & LOCKED){ printf(" locked,"); ++adj; } if(t->state & BROKEN){ printf(" broken,"); ++adj; } /* Turn the indefinite article "a" into "an" if necessary */ if(adj == 0 && (t->article == SINGULAR || t->article == OWDESC) && isvowel(t->desc[0])){ printf("n"); } /* Description of object */ printf(" %s %s.\n", t->desc, t->name); } else{ if(t->article == OWDESC){ printf("\b"); } /* Turn the indefinite article "a" into "an" if necessary */ if((t->article == SINGULAR) && isvowel(t->name[0])){ printf("n"); } printf(" %s; ", t->name); } }
int main() { int i; for(i = 90; i >= 65; i--) { if(!isvowel(i)) { printf("%c", i); } } system("pause"); return 0; }
/* interject for a moment */ static void interject(void) { printf("I'd just like to interject for a moment. What you're "); printf("referring to as %s, is in fact, %s/%s, ", osname, gnu, osname); printf("or as I've recently taken to calling it, %s plus %s. ", gnu, osname); if (head) return; printf("%s is not a%s %s unto itself ", osname, isvowel(operating[0]) ? "n" : "", operating); printf("but rather another free component of a fully functioning " "%s system made useful by the %s ", gnu, useful); printf("comprising a full %s as defined by %s. ", os, defined); printf("Many computer users run a modified version of the %s system " "every day, without realizing it. ", gnu); printf("Through a peculiar turn of events, the version of %s which is " "widely used today is often called \"%s\"", gnu, osname); printf(", and many of its users are not aware that it is basically the " "%s system, developed by the %s. ", gnu, developed); printf("There really is a %s, and these people are using it, but it is " "just a part of the system they use. ", osname); printf("%s is the %s: %s. ", osname, kernel, description); printf("The %s is an essential part of a%s %s, ", kernel, isvowel(operating[0]) ? "n" : "", operating); printf("but useless by itself; it can only function within the " "context of a complete %s. ", operating); printf("%s is normally used in combination with the %s %s: the whole " "system is basically %s with %s added, or %s/%s", osname, gnu, operating, gnu, osname, gnu, osname); printf(". All these so-called \"%s\" distributions are really " "distributions of %s/%s.", osname, gnu, osname); }
char *removeVowels(char *str) { int count = 0; // Same concept used in removeSpaces char *ret = malloc(myStrlen(str)); for (int i=0; str[i]; ++i) { if (isvowel(str[i])) { ++count; continue; } ret[i-count] = str[i]; } return ret; }
inline bool isconsonant(unsigned short c) { switch( c ) { // Some cyrillic letters are neither vowels, nor consonants, or otherwise // the letters no word can start from. case 0x439: case 0x44A: case 0x44C: case 0x45E: return false; default: break; } return (isletter(c) && !isvowel(c)); }
int main() { int i=0,j=0; char code[105]; char decode[105]; scanf("%[^\n]s",code); int n=strlen(code); while(i<(n)) { if(isvowel(code[i])) {decode[j++]=code[i];i+=3;} else { decode[j++]=code[i];i+=1; } } decode[j]='\0'; printf("%s",decode); return 0; }
void count_vowels_and_consonants(char *str,int *consonants, int *vowels){ *consonants = 0; *vowels = 0; if (str == NULL) ; else { int len = length(str); for (int i = 0; i < len; i++) { int n = isvowel(str[i]); if (n == 0) continue; else if (n>0) *vowels = *vowels + 1; else if (n < 0) *consonants = *consonants + 1; } } }
const char * shMonster::an () { char *buf = GetBuf (); if (!Hero.canSee (this) and !Hero.canHearThoughts (this)) { strncpy (buf, hasMind () ? "someone" : "something", SHBUFLEN); } else if (isUnique ()) { return the (); } else if (Hero.is (kXenosHunter) and isXenos ()) { snprintf (buf, SHBUFLEN, "a xenos scum"); } else if (Hero.is (kXenosHunter) and isHeretic ()) { snprintf (buf, SHBUFLEN, "a heretic"); } else { snprintf (buf, SHBUFLEN, isvowel (myIlk ()->mName[0]) ? "an %s" : "a %s", myIlk ()->mName); } return buf; }
/* corey... and, of course, stanley toles... */ void process(char *s) { int i = 0; bool state = false, add_ay = false; char first_letter; while (s[i]) { if (isalpha(s[i])) { if (!state) { if (isvowel(s[i])) { putchar(s[i]); add_ay = true; } else { first_letter = s[i]; } } else { putchar(s[i]); } state = true; } else { if (state) { if (add_ay) { printf("ay"); add_ay = false; } else { printf("%c%s", first_letter, "ay"); } } putchar(s[i]); state = false; } i++; } if (state) { if (add_ay) { printf("ay"); add_ay = false; } else { printf("%c%s", first_letter, "ay"); } } }
int main(){ int n,i,j,len,flag,hasvowel,hascon,same; char w[21]; while(scanf("%s",&w)!=EOF){ if(strcmp(w,"end")==0) break; flag=hasvowel=same=hascon=0; len=strlen(w); for(i=0;i<len;i++){ if(isvowel(w[i])) hasvowel=1; if(i>0&&w[i]==w[i-1]&&w[i]!='e'&&w[i]!='o') same=1; if(i>1&&iscon(w[i],w[i-1],w[i-2])) hascon=1; } if(hasvowel&&!hascon&&!same) flag=1; printf("<%s> is %sacceptable.\n",w,flag?"":"not "); } return 0; }
std::string Team::getName() const { if (superheroes.size() == 0) return ""; std::string answer; std::list<Superhero>::const_iterator itr; for (itr = superheroes.begin(); itr != superheroes.end(); itr++) { char first_consonant = ' '; char first_vowel = ' '; std::string true_identity = itr->getTrueIdentity(); for (int j = 0; j < true_identity.size(); j++) { if (first_consonant == ' ' && isconsonant(true_identity[j])) first_consonant = tolower(true_identity[j]); if (first_vowel == ' ' && isvowel(true_identity[j])) first_vowel = tolower(true_identity[j]); } answer.push_back(first_consonant); answer.push_back(first_vowel); } answer[0] = toupper(answer[0]); return answer; }
char* name_before( obj_clss_data* obj ) { char* tmp; const char* singular; if( obj == NULL ) return "## Null Pointer?? ##"; tmp = static_string( ); strcpy( tmp, is_set( obj->extra_flags, OFLAG_THE ) ? "the " : "an " ); if( obj->prefix_singular != empty_string ) sprintf( tmp+strlen( tmp ), "%s ", obj->prefix_singular ); singular = seperate( obj->singular, FALSE ); switch( *obj->before ) { case '\0' : strcat( tmp, singular ); break; case '+' : sprintf( tmp+strlen( tmp ), "%s %s", singular, &obj->before[1] ); break; default : sprintf( tmp+strlen( tmp ), "%s%s%s", obj->before, *obj->before == '\0' ? "" : " ", singular ); break; } if( *tmp == 't' || isvowel( tmp[3] ) ) return tmp; tmp[1] = 'a'; return &tmp[1]; }