#include <iostream> #include <stdio.h> using namespace std;
int main(){ int y; cin>>y; y=y%12; switch (y){ case 4:{cout<<"Mouse"; break;} case 5:{cout<<"Bull";break;} case 6:{cout<<"Tiger";break;} case 7:{cout<<"Rabbit";break;} case 8:{cout<<"Dragon";break;} case 9:{cout<<"Snake";break;} case 10:{cout<<"Horse";break;} case 11:{cout<<"Goat";break;} case 0:{cout<<"Monkey";break;} case 1:{cout<<"Cock";break;} case 2:{cout<<"Dog";break;} case 3:{cout<<"Pig";break;} } cin.get(); cin.get(); return 0; }
Program Ulitka; Var SunnyDay: Array [1..30] Of Boolean; a, b, c, i: Integer; Begin WriteLn('a = '); ReadLn(a); WriteLn('b = '); ReadLn(b); b := b * 100; Randomize; For i := 1 To 30 Do Begin If Random(2) = 1 Then SunnyDay[i] := True Else SunnyDay[i] := False; End; For i := 1 To 30 Do Begin If SunnyDay[i] = True Then Begin a := a + 2; If a > b Then a := b; End Else Begin a := a - 1; If a < 0 Then a := 0; End; End; WriteLn('Дни месяца были таковы:'); For i := 1 To 30 Do Begin If SunnyDay[i] = True Then WriteLn(i, '. Солнечный') Else WriteLn(i, '. Пасмурный') End; WriteLn('К концу 30 дня местоположение улитки равно ', a, ' см над землей'); ReadLn; End.
#include <stdio.h>
using namespace std;
int main(){
int y;
cin>>y;
y=y%12;
switch (y){
case 4:{cout<<"Mouse"; break;}
case 5:{cout<<"Bull";break;}
case 6:{cout<<"Tiger";break;}
case 7:{cout<<"Rabbit";break;}
case 8:{cout<<"Dragon";break;}
case 9:{cout<<"Snake";break;}
case 10:{cout<<"Horse";break;}
case 11:{cout<<"Goat";break;}
case 0:{cout<<"Monkey";break;}
case 1:{cout<<"Cock";break;}
case 2:{cout<<"Dog";break;}
case 3:{cout<<"Pig";break;}
}
cin.get();
cin.get();
return 0;
}
Var SunnyDay: Array [1..30] Of Boolean;
a, b, c, i: Integer;
Begin
WriteLn('a = ');
ReadLn(a);
WriteLn('b = ');
ReadLn(b);
b := b * 100;
Randomize;
For i := 1 To 30 Do
Begin
If Random(2) = 1 Then
SunnyDay[i] := True
Else
SunnyDay[i] := False;
End;
For i := 1 To 30 Do
Begin
If SunnyDay[i] = True Then
Begin
a := a + 2;
If a > b Then
a := b;
End
Else
Begin
a := a - 1;
If a < 0 Then
a := 0;
End;
End;
WriteLn('Дни месяца были таковы:');
For i := 1 To 30 Do Begin
If SunnyDay[i] = True Then
WriteLn(i, '. Солнечный')
Else
WriteLn(i, '. Пасмурный')
End;
WriteLn('К концу 30 дня местоположение улитки равно ', a, ' см над землей');
ReadLn;
End.