i am definitely a newbie here, i being thinking of this code for 2 hours and that kill my brain.. so i reach here to ask for help.
my problem is i couldnt sum up the binary number , for example
character 'd' = 1100100 and 'e' = 1100101
the answer is add up the one which is d = 3 + e = 4 sum = 7
so the sum (cout<<sum;) will be 7
and can some one explain this code wich i got it in this forum
anyone can give another example similar code that is easy to understand?Code:#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <bitset>
using namespace std;
int main()
{
string name;
string lowerCase;
int sum = 0;
int total = 0;
//prompt user input
cout<<"Please enter your name to generate password: ";
cin>>name;
for( string::iterator it = name.begin(); it != name.end(); ++it )
cout << bitset<7>((unsigned long)*it) <<" ";
system("pause");
return 0;
}