예제 #1
0
QString get_Possessive_form(QString word)
{
	if (word.length()>=2)
	{
		int last_index=getLastLetter_index(word);
		QChar last=getLastLetter(word,last_index);
		QChar before=getLastLetter(word.left(last_index));
		if (last==alef && isConsonant(before))
                        return removeLastDiacritic(word).append(waw).append(ya2);
		else if (last==alef && before==waw )
                        return removeLastDiacritic(removeLastLetter(word)).append(ya2);
		else if (last==alef && before==ya2 )
                        return removeLastDiacritic(removeLastLetter(word)).append(shadde);
		else if (last==ta2_marbouta && isConsonant(before))
                        return removeLastDiacritic(removeLastLetter(word)).append(ya2);
		else if (last==ya2)
                        return removeLastDiacritic(word).append(shadde);
		else if (isConsonant(last) || last==waw)
                        return removeLastDiacritic(word).append(ya2);
		else
		{
			out << "Unknown Rule for Possessive form\n";
			return QString::null;
		}
	}
	else
		return word.append(ya2);
}
예제 #2
0
// get random card from game->letters and sort letters array.
char getNewCard(struct game *g){
        char c = 'z' ;
        time_t t;
        int n = getLastLetter(g->letters,LETTERSSZ-1 );
        if(n){
                srand((unsigned) time(&t));
                int r = rand()%n ;
                c = g->letters[r] ;
                g->letters[r] = g->letters[n];
                g->letters[n] = '*' ;
        }
        else {
                c = g->letters[n] ;
                g->letters[0] = '*';
        }
        return c ;
}