ASCII To Hex Converter

M

Matthew Eagle

Good Evening,

I was wondering if anyone would be willing to help me code a ASCII to Hex
Converter, I'm very good at reading code, just not writing it, It is a bit
unfortunate, but any help would be great.
 
?

=?iso-8859-1?q?Erik_Wikstr=F6m?=

Good Evening,

I was wondering if anyone would be willing to help me code a ASCII to Hex
Converter, I'm very good at reading code, just not writing it, It is a bit
unfortunate, but any help would be great.

The basic idea:

#include <iostream>
#include <string>

int main()
{
std::string str = "Hello";

typedef std::string::iterator iter;
for (iter i = str.begin(); i != str.end(); ++i)
std::cout << std::hex << static_cast<int>(*i);
}

from there you should be able to work the rest out by yourself.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top