Программа ** c++(30)

0 голосов
69 просмотров

Программа на c++(30)


image

Информатика (858 баллов) | 69 просмотров
Дан 1 ответ
0 голосов
Правильный ответ

//Dev-C++ 5.11

#include
using namespace std;

int main(void)
 {const int mounthDuration[]={0,31,28,31,30,31,30,31,31,30,31,30,31};
 char c;
 int boxNum,n,boxMounth,boxDay,currentDay,currentMounth,res[100],resi=0;
 for(int j=0;j<5;j++)<br>  {cin>>c;
  switch(j){
   case 0:currentDay=(c-'0')*10; break;
   case 1:currentDay+=c-'0'; break;
   case 3:currentMounth=(c-'0')*10; break;
   case 4:currentMounth+=c-'0'; break;}}
 cin>>n;
    for(int i=0;i  {cin>>boxNum;
  for(int j=0;j<5;j++)<br>  {cin>>c;
  switch(j){
   case 0:boxDay=(c-'0')*10; break;
   case 1:boxDay+=c-'0'; break;
   case 3:boxMounth=(c-'0')*10; break;
   case 4:boxMounth+=c-'0'; break;}}
  if(boxMounth==currentMounth)
   {if(currentDay-boxDay>3)
    {res[resi]=boxNum;
    resi++;}}
  else
  if(currentMounth-boxMounth>=1 && currentDay+(mounthDuration[boxMounth]-boxDay)>3)
   {res[resi]=boxNum;
    resi++;}}
 for(int i=0;i  cout<<res[i]<<endl;<br>  return 0;}

(38.6k баллов)