Пример #1
0
void Student2::set_student2()
{
	set_student();
	cout << "Degree: ";
	string degree;
	cin >> degree;
	set_degree(degree);
	cout << "\n";

	if (get_semester() != 0)
	{
		cout << "Type averages for semesters:\n";
		double *average = new double[get_semester()];
		for (int i = 0; i < get_semester(); i++)
		{
			cout << i + 1 << ". ";
			cin >> average[i];
		}
		set_average(average);
	}
Пример #2
0
/*static*/
 WantGkEnd(gk_string *wantend, gk_string *haveend, bool writeflag, int strict)
{
	int compval;

	word_form wform, hform;
/*
	Dialect wdial = dialect_of(wantend);
	Dialect hdial = dialect_of(haveend);
*/
	Dialect wdial;
	Dialect hdial;

	Dialect d/*, AndDialect()*/;

	int wmood = mood_of( forminfo_of(wantend) );
	int hmood = mood_of( forminfo_of(haveend) );

	int wvoice = voice_of( forminfo_of(wantend) );
	int hvoice = voice_of( forminfo_of(haveend) );

	int wtense = tense_of( forminfo_of(wantend) );
	int htense = tense_of( forminfo_of(haveend) );

	int wgender = gender_of( forminfo_of(wantend) );
	int hgender = gender_of( forminfo_of(haveend) );

	int wdegree = degree_of( forminfo_of(wantend) );
	int hdegree = degree_of( forminfo_of(haveend) );

	int wcase = case_of( forminfo_of(wantend) );
	int hcase = case_of( forminfo_of(haveend) );

	int wperson = person_of( forminfo_of(wantend) );
	int hperson = person_of( forminfo_of(haveend) );

	int wnumber = number_of( forminfo_of(wantend) );
	int hnumber = number_of( forminfo_of(haveend) );

	char wendstr[MAXWORDSIZE];
	char * hendstr = gkstring_of(haveend);

	wform = forminfo_of(wantend);
	hform = forminfo_of(haveend);
	
/*
 * basically, we check to see if any particular form has been requested
 * and check each ending against this. if nothing is asked for (e.g. no
 * mood or voice is specified) then we just take the ending (i.e. we take
 * subjunctive, optative, indicative etc. rather than just the optatives or
 * subjunctives or whatever...
 */
	setwendstr(wendstr,gkstring_of(wantend));
	if( wmood && hmood != wmood ) {
		if( hmood || (!hmood && strict) ) {
#ifdef SHOWFAIL
printf("failing on wmood %o hmood %o\n", wmood, hmood );
#endif
			return(0);
		}
	}

/*
 *
 *  perfect actives are, by definition, always active in form
 */


   	if( (stemtype_of(wantend) & PPARTMASK ) == PP_PF ) {
   		wvoice = ACTIVE;
   		voice_of(wform) = ACTIVE;
   	}

   	if( (stemtype_of(wantend) & PPARTMASK ) == PP_SU && 
	     cur_lang() == LATIN && wvoice == DEPONENT ) {
			set_voice(forminfo_of(haveend), wvoice);
   	}

	if( cur_lang() == LATIN && wvoice == DEPONENT ) {
		if( hvoice == ACTIVE && hmood != PARTICIPLE && hmood != GERUNDIVE ) return(0);
	} else if( wvoice ) {
		if( ! Want_Voice( wform , hform )) {
		   if( hvoice || (!hvoice && strict)) {
#ifdef SHOWFAIL
printf("have [%s] failing on wvoice %o hvoice %o\n",hendstr, wvoice, hvoice );
#endif
				return(0);
			}
		} else {
/*
 * note that an ending may generally be either middle or passive, but
 * if the stem in hand is strictly middle or strictly passive,
 * then the ending inherits that limitation.
 */

			if( writeflag == YES )
			   set_voice(forminfo_of(haveend), wvoice);
		}
	}

	if( wtense && htense != wtense )
		if( htense || (!htense && strict) ) {
#ifdef SHOWFAIL
printf("failing on wtense %o htense %o\n", wtense, htense );
#endif
			return(0);
		}

/*
 * note that here you only fail if the gender is set in the
 * ending as well as in the stem.
 * 
 * if we follow the normal algorithm, a masculine stem would 
 * not match a set of endings that had no gender specified.
 *
 * likewise, we need to match either masculine or feminine against
 * an ending that is common to both (but not, for example, to a neuter
 * stem, e.g. -es in nom pl for masc and fem, but -a for neuter)
 */
/*

/*
 * only fail if gender set for both.
 * 	e.g., dwr- from dw=ron will want to find 
 * endings such as -on, or -a that are specifically flagged
 * as neuter, but will also want to find other endings
 * that can attach themselves to any gender
 */
	if( wgender ) {
		if( hgender ) {
			if( ! Want_Gender(wform, hform)) {
#ifdef SHOWFAIL
printf("failing with hgender %o and wgender %o\n", hgender , wgender );
#endif
				return(0);
			}
		}
		if( writeflag )
			if( Want_Gender(wform,hform) )
				set_gender(forminfo_of(haveend), Want_Gender(wform, hform));
			else
			   	set_gender(forminfo_of(haveend), wgender );
	}

	if( wcase ) {
		if( ! Want_Case(wform, hform))
			if( hcase || (!hcase && strict) ) {
#ifdef SHOWFAIL
printf("failing with hcase %o wcase %o\n", hcase , wcase );
#endif
				return(0);
			}
if( writeflag ) {
#ifdef SHOWFAIL
printf("[%s] hcase %o wcase %o anded %o\n", gkstring_of(haveend), hcase, wcase, hcase & wcase );
#endif
		set_case(forminfo_of(haveend) , wcase&hcase );
}
	}

	if( wperson && hperson != wperson ) {
		if( hperson || (!hperson && strict) ) {
#ifdef SHOWFAIL
printf("failing with hperson %o wperson %o\n", hperson , wperson );
#endif
			return(0);
		}
	}

	if( wnumber && hnumber != wnumber )
		if( hnumber || (!hnumber && strict) ) {
#ifdef SHOWFAIL
printf("failing on wnumber %o hnumber %o\n", wnumber , hnumber );
#endif
			return(0);
		}

	if( *wendstr && strict ) {
	
		if( (compval=endstrcmp(wendstr,hendstr))){
	/*
	 * this expects that you have a sorted list of endings and that you
	 * don't want to look for endings that are alphabetically larger
	 * than the ending that you want 
	 */
			if( compval < 0 && noaccstrcmp(wendstr,hendstr) ) {

#ifdef SHOWFAIL
#endif

				return(compval);
			}
#ifdef SHOWFAIL
printf("failing on wendsrr\n");
#endif
		/*
		 * don't fail if you did not specifically ask for a long vowel.
		 *
		 * do fail if you specifically ask for a long vowel and this ending is not 
		 * marked as long.
		 */
		if( has_quantacc(hendstr) != has_quantacc(wendstr) ) {
			char tmp[MAXWORDSIZE];
			
			Xstrncpy(tmp,hendstr,MAXWORDSIZE);
			stripquantacc(tmp);
			compval=endstrcmp(wendstr,tmp);
/*
			compval=dictstrcmp(wendstr,tmp);
*/
			if( compval  ) 				
						return(0);
		}  else
						return(0);
		} else {
			/*
			 * if you ask for "w=", then match only "w=" and not "w".
			 *
			 * if you ask for "w", however, then match both "w=" and "w".
			 */

			if( hasaccent(wendstr)  ) {
				char tmp1[MAXWORDSIZE];
				char tmp2[MAXWORDSIZE];
				
				Xstrncpy(tmp1,wendstr,(int)sizeof tmp1);
				stripquant(tmp1);
				
				Xstrncpy(tmp2,hendstr,(int)sizeof tmp2);
				stripquant(tmp2);
				if( strcmp(tmp1,tmp2) )
						return(0);
			}
		}
	}

	if(  ! EuphEnd(wantend,haveend,strict) ) {
#ifdef SHOWFAIL
printf("[%s] failing on euph end\n", gkstring_of(haveend) );
#endif
		return(0);
	}
	wdial = dialect_of(wantend);
	hdial = dialect_of(haveend);

/*
 * note that we are checking not for equality, but to see if
 * we want any of the dialect bits set for the current ending
 */
	if( (d=AndDialect(hdial,wdial)) < 0 )
		return(0);
/*
	else if( writeflag ) {
		set_dialect(haveend,d);
	}
*/
/*
 * we currently mark a)/ristos as "os_h_on superl". 
 * we thus want a)rist- to have all the normal endings (-os,-h,-on,-ou,-hs,-ou)
 * but not to have endings such as "-o/tatos" or "-w/teros" tacked onto it.
 */
 
/*
 * grc 6/5/89
 *
 * this system prevents morphology formulas from generating any actual endings.  the
 * formula has the flag "comp" or "superl", but none of the endings in the basic
 * paradigms are so marked, so they are all skipped.  i added the requirement that this
 * rule only be active if strict is non zero to get around this (this is much the same
 * strategy that we took with iteratives.
 */
	if( wdegree ) {
		if(  hdegree && wdegree != hdegree /* grc 6/5/89 */ && strict /* end mod*/) {
			if( hdegree || (!hdegree && strict) )
				return(0);
		}
		if( wdegree && writeflag ) set_degree(forminfo_of(haveend),wdegree);
	}

	if( ! RightMorphflags(wantend,haveend)) {
#ifdef SHOWFAIL
printf("[%s] failing on rightmorphflags\n", gkstring_of(haveend) );
#endif
		return(0);
	}
	return(1);
}