string concatenuation

i want to ask how to add 3 different string

1
2
3
4
5
6
7
8
9
10
11
12
13
  Put the code you need help with here.
#include <iostream>
#include <string>
using namespace std
int main()
int day,month,year;
string a = " enter day";
string b =" enter month";
string c= "enter year";
cout << a; cin>>day;
cout<< b; cin>>month;
cout<<c; cin>>year;
cout<< a+b+c;

the part i want to ask is when i add 3 string a, b and c in line "cout<< a+b+c;" how can i make the output of this line in the whole date which format is like 'dd/mm/yyyy'(13/10/2017) but not output like"enter day enter month enter year", which i mean the output is the combination of the input of int(day,month,year) not the strings a,b,c.
Maybe you don't need strings, you just need to format the output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <iostream>
#include <iomanip>

using namespace std;

int main()
{
    int day = 0, month = 0, year = 0;

    cout << " enter day   "; cin >> day;
    cout << " enter month "; cin >> month;
    cout << " enter year  "; cin >> year;

    cout.fill('0');
    cout << setw(2) << day   << '/'
         << setw(2) << month << '/'
         << setw(4) << year
         << '\n';

}
 enter day   13
 enter month 10
 enter year  2017
13/10/2017
what does
cout.fill('0'); do?
Topic archived. No new replies allowed.