+ 1
string concatenuation
String a= âdayâ; String b=âmonthâ; String c=âyearâ; Cout << a ; Cin>>x(day); Cout <<b; Cin>>y(month); Cout<<c; Cin>> z(year); I want to ask how to add string a,b,and c together but the output is the date(x/y/z) not the string?
5 Answers
+ 3
simply,take a look at the code.
https://code.sololearn.com/ch8JQeQarwm0/?ref=app
+ 2
hi,
an example to adapt
string a="", b="",c="";
cin>>a;
cin>>b;
cin>>c;
string date=a+"/"+b+"/"+c;
cout<<date<<endl;
+ 2
I edited the code for getting date
https://code.sololearn.com/ch8JQeQarwm0/#cpp
0
I thought the output should be number like 04/12/2017? Sorry I am just beginner so would you mind explaining more to me?
0
Here is the full task: Write the code that asks user to enter a month number (mm), day (dd), then year (yyyy) in this specific order.
The program then displays the date in the format "yyyy/mm/dd".
All variables should be string, not integer. Use string concatenation to create a new string that contains the whole date.