The program illustrates the use of modulo operators
The modulo operator is used to return the remainder of a division
Take for instance:
5 % 3 is 2, because the result of 5 divided by 3 is 1 remainder 2
So, the complete program, where comments are used to explain each line is as follows:
#include<iostream>
#include<string>
using namespace std;
int main(void) {
//This declares num as integer
int num;
//This declares binary as string
string binary;
//This gets input for num
cin>>num;
//The following iteration is repeated while num is greater than 0
while(num>0){
//This gets the remainder of num divided by 2
binary+=to_string(num%2);
//This divides num by 2
num/=2;
}
//The reverses the binary string
binary = string(binary.rbegin(),binary.rend());
//This prints the binary string
cout<<binary;
return 0;
}
At the end of the program, the binary string is printed
See attachment for sample run
Read more about modulo operators at:
https://brainly.com/question/17760417