Добавил:
bagiwow
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Программирование / Лабораторные / 8 вариант 1 курс / laba7.1 / laba 7
.1.cpp//по номеру года выдает его название по старояпонскому календарю
//по названию месяца выдает его знак задиака
#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;
}