Отсчет месяцев и недель.....
ввод: 4 недели
выход: 52;
вход:30 месяца 11.
выход:11;
годом считается 2016-й.Но моя программа не работает уже несколько недель..значение контрольной переменной всегда остается 0..помогите пожалуйста.
Что я уже пробовал:
#include <iostream> #include #define pii pair<int> using namespace std; int main() { long long n; string s; while(getline(cin,s)) { int len=s.size(); int number=0;int check=0; int i=0; while(s[i]!=' ') { int digit=s[i]-'0'; number*=10; number+=digit; i++; } string ss; for(;i<len;i++)> { if(s[i]=='w') { break; check=1; } } if(check==1) //here value of check is always remains 0 { // what's the problem cann't understand. if(number>=5 and number<=7) cout<<"53\n"; else if(number>=2 and number<=4) cout<<"52\n"; else cout<<"51\n"; } else{ if(number<30) cout<<"12\n"; if(number==30) cout<<"11\n"; else if(number==31) { cout<<"7\n"; } } // cout<<ss<<endl; } // { // bool row[n]; // bool col[n]; //asphalting roads code // memset(row,0,sizeof row); // memset(col,0,sizeof col); // map<pii,int>m; // //int road[n][n]; // int x,y; // for(int i=1;i<=n*n;i++) // { // cin>>x>>y;; // int b=make_pair(x,y); // m[x]=1; // //road[x-1][y-1]=1; // // } // int day=1; // int size=m.size(); // for(map<int,int>::iterator it=m.begin();it!=m.end();it++) // { // x=it->first; // y=it->second; // if(row[x-1]==0 and col[y-1]==0) // cout<<day<<" "; // else if(row[x-1]==0 and col[y-1]==0 and day==size-1) // cout<<day<<"\n"; // day++; // // } // for(int i=1;i<=n;i++) // { // for(int j=1;j<=n;j++) // { // if(road[i][j]==1) // { // if(row[i]==0 and col[j]==0) // { // cout<<day<<" "; // } // day++; // } // } // } //cout << "Hello world!" << endl; return 0; }
PIEBALDconsult
Пожалуйста, используйте "улучшить вопрос", чтобы добавить больше деталей и контекста.