Скачиваний:
50
Добавлен:
10.12.2013
Размер:
2.52 Кб
Скачать
//по номеру года выдает его название по старояпонскому календарю
//по названию месяца выдает его знак задиака


#include <stdio.h>
#include <string.h>
#include <iostream.h>


template <class type >
char *form (type r)
{
		cout<<"Vvedite nomer goda: ";
		cin>>r;
		int z;
		z=int (r);
		char s[25];
		if(z%12==0) strcpy (s,"Obez'yana");
		if(z%12==1) strcpy (s,"Petux");
		if(z%12==2) strcpy (s,"Sobaka");
		if(z%12==3) strcpy (s,"Kaban");
		if(z%12==4) strcpy (s,"Krysa");
		if(z%12==5) strcpy (s,"Byk");
		if(z%12==6) strcpy (s,"Tiger");
		if(z%12==7) strcpy (s,"Krolik");
		if(z%12==8) strcpy (s,"Drakon");
		if(z%12==9) strcpy (s,"Zmeya");
		if(z%12==10) strcpy (s,"Loshad'");
		if(z%12==11) strcpy (s,"Ovca");
	return s;
}
char *form1 ( char n[25],int p)
{
		char m[10];
		if ((strcmp (n,"january")==0)&&(p==1)) strcpy (m,"kozreog");
		if ((strcmp (n,"december")==0)&&(p==2)) strcpy (m,"kozreog");
		if ((strcmp (n,"february")==0)&&(p==1))strcpy (m,"vodoley");
		if ((strcmp (n,"january")==0)&&(p==2)) strcpy (m,"vodoley");
		if ((strcmp (n,"mart")==0)&&(p==1)) strcpy (m,"ryby");
		if ((strcmp (n,"february")==0)&&(p==2))strcpy ( m,"ryby");
		if ((strcmp (n,"april")==0)&&(p==1))strcpy ( m,"oven");
		if ((strcmp (n,"mart")==0)&&(p==2)) strcpy (m,"oven");
		if ((strcmp (n,"may")==0)&&(p==1))strcpy ( m,"telec");
		if ((strcmp (n,"april")==0)&&(p==2))strcpy ( m,"telec");
		if ((strcmp (n,"june")==0)&&(p==1))strcpy ( m,"bliznecy");
		if ((strcmp (n,"may")==0)&&(p==2))strcpy ( m,"bliznecy");
		if ((strcmp (n,"jule")==0)&&(p==1))strcpy (m,"rak");
		if ((strcmp (n,"june")==0)&&(p==2))strcpy ( m,"rak");
		if ((strcmp (n,"august")==0)&&(p==1)) strcpy (m,"deva");
		if ((strcmp (n,"jule")==0)&&(p==2))strcpy (m,"deva");
		if ((strcmp (n,"september")==0)&&(p==1))strcpy (m,"lev");
		if ((strcmp (n,"august")==0)&&(p==2)) strcpy (m,"lev");
		if ((strcmp (n,"october")==0)&&(p==1)) strcpy (m,"vesy");
		if ((strcmp (n,"september")==0)&&(p==2)) strcpy (m,"vesy");
		if ((strcmp (n,"november")==0)&&(p==1))strcpy ( m,"scorpion");
		if ((strcmp (n,"october")==0)&&(p==2)) strcpy (m,"scorpion");
		if ((strcmp (n,"december")==0)&&(p==1))strcpy ( m,"strelec");
		if ((strcmp (n,"november")==0)&&(p==2)) strcpy (m,"strelec");
	return m;
}
void main()
{	
	char n[10],m[25],s[25];
	int p;
	double r;
	strcpy(s,form(r));
	cout<<s<<endl;
	cout<<"nazvanie mesyaca: ";
	cin>>m;
	cout<<"polovinu mesyaca: ";
	cin>>p;
	strcpy(s,form1(m,p));
	cout<<s<<endl;
}
Соседние файлы в папке laba7.1
  • #
    10.12.20132.52 Кб50laba 7.1.cpp
  • #
    10.12.20133.43 Кб50laba 7.1.dsp
  • #
    10.12.2013541 б50laba 7.1.dsw
  • #
    10.12.201341.98 Кб50laba 7.1.ncb
  • #
    10.12.201348.64 Кб50laba 7.1.opt
  • #
    10.12.20131.75 Кб51laba 7.1.plg