Alright, so I had an assignment in c++ where the user was to input a day and if the day was less than 10, the program would have to output a 0 in front of it. If the day was greater than 10, the program would output the day. An example would be if the user inputs 5, the program would output 05. If the user inputs 24, the program would output 24. My question is how do we define the 0 in front of the 5. This is the snippet of code of which I attempted but to no avail.
if (day < 10){
f = 0 << day;
}
else {
f = day;
}
This is the statement I'm struggling with: f = 0 << day;
Any help would be great.
Thanks.