0

the date of birtth in code ( Help me here !!! )

#include <iostream> using namespace std; int main() { double D,d,M,m,Y1,Y2,Y3,Y4; cin>>D; // input the first number of the day cin>>d; // input the second number of the day cin>>M; // input the first number of the month cin>>m; // input the second number of the month cin>>Y1; // input the first number of the year cin>>Y2; // input the second number of the year cin>>Y3; // input the third number of the year cin>>Y4; // input the fourth number of the year switch (DdMmY1Y2Y3Y4){ case : cout<<D+D<<"_"<<D+d<<"_"<<D+M<<"_"<<D+m<<"_"<<D+Y1<<"_"<<D+Y2<<"_"<<D+Y3<<"_"<<D+Y4<<"_"<<d+D<<"_"<<"_"<<d+d<<"_"<<d+M<<"_"<<d+m<<"_"<<d+Y1<<"_"<<d+Y2<<"_"<<d+Y3<<"_"<<d+Y4<<"_"<<"_"<<M+D<<"_"<<M+d<<"_"<<M+M<<"_"<<M+m<<"_"<<M+Y1<<"_"<<M+Y2<<"_"<<M+Y3<<"_"<<M+Y4<<"_"<<m+D<<"_"<<m+d<<"_"<<m+M<<"_"<<m+m<<"_"<<m+Y1<<"_"<<m+Y2<<"_"<<m+Y3<<"_"<<m+Y4<<"_"<<Y1+D<<"_"<<Y1+d<<"_"<<Y1+M<<"_"<<Y1+m<<"_"<<Y1+Y1<<"_"<<Y1+Y2<<"_"<<Y1+Y3<<"_"<<Y1+Y4<<"_"<<Y2+D<<"_"<<Y2+d<<"_"<<Y2+M<<"_"<<Y2+m<<"_"<<Y2+Y1<<"_"<<Y2+Y2<<"_"<<Y2+Y3<<"_"<<Y2+Y4<<"_"<<Y3+D<<"_"<<Y3+d<<"_"<<Y3+M<<"_"<<Y3+m<<"_"<<Y3+Y1<<"_"<<Y3+Y2<<"_"<<Y3+Y3<<"_"<<Y3+Y4<<"_"<<Y4+D<<"_"<<Y4+d<<"_"<<Y4+M<<"_"<<Y4+m<<"_"<<Y4+Y1<<"_"<<Y4+Y2<<"_"<<Y4+Y3<<"_"<<Y4+Y4; break; return 0 ; } /* what is problem in thi code ??? pls help */

16th Jan 2017, 5:05 PM
Veljko
Veljko - avatar
2 Answers
+ 1
why using switch
16th Jan 2017, 5:10 PM
Kawaii
Kawaii - avatar
+ 1
First you did not give the case a case condition. secondly in your switch(xyz) your xyz does not work as concatenation. it multiplys all numbers in best case. Thirdly do not use a switch case for strings in c++
16th Jan 2017, 5:12 PM
Andreas K
Andreas K - avatar