+ 19
Q1 "Why only 1 zero is printing?Why not 2? "
It's because the default field width for C++ standard output ( minimum space given for data to be printed on screen ) is zero, so it simply prints the number in the minimum possible space it can ( without any leading zeros )
Q2 " How can I print 00 instead of 0? "
You can use std::setw() to set the field width to your desired number ( 2 in this case ) and use std::setfill () to specify what to fill that empty space with instead of the default whitespace character ( '0' in this case )
Something like this :-
```
std::cout << std::setw(2) << std::setfill('0') << integer;
```
------
Usefull links :-
std::setw () : https://en.cppreference.com/w/cpp/io/manip/setw
std::setfill () : https://en.cppreference.com/w/cpp/io/manip/setfill
-----
P.S. you can also use standard format library to achive this if you are working with C++20 (or above )
+ 7
Manav Roy i went back and had a look at my solution(i did it in C) and I've used an if statement to check for equality and printed the string "00". I did similarly for the other cases too. I guess you can use conversions between string and integer if needed, but you can do it without the conversions. Since it's C++ that you're using here, I'd go for @Arsenic 's solution for sure.
"If you want to build a table, you use hammer, chainsaw and other tools available. It's not a clever thing to build those tools from scrach, as it's already done by someone. Rather use those tools and build something new, bigger and better"
-Martin Taylor
I know those words aren't exactly in place but this what he meant by his message in one of his answers
+ 5
because its integer 00 == 0
use a string to do that
cout << "00";
+ 5
Why do you want to print two zeros? Here you are storing the 0 in octal format in n. Since you start with a 0, it recognises it as octal, and stores the 2nd 0 in n. If you want to print it as it is, use @NonStop CODING's solution
+ 2
Infinity
in terms of what memory or non programming language ??
+ 2
Here is my work around for solving this challenge
But please try solving it yourself before looking at solution
https://code.sololearn.com/cPy9lmEOji2g/?ref=app
+ 2
if (hours <10)
cout << "0" << hours << ":" << minutes <<endl;
+ 1
in real life both exist
memory size and money
16 bit > 1 bit
0 is 000.......
it's becoming a jokeđđđ
+ 1
use string
write 00 inside string
+ 1
I couldn't have said it better Rishi
đ đšđ