problem is a little harder than I expected maybe b/c of the specifications of the problem. Help would be appreciated because I've turned this into a mess.

Input is a command line argument representing int between 0 and 255
Output: convert string to binary and output as array of numbers (0's and 1's)

I'll just throw out the basic algorithm since the program is on another pc.

-input comes in using argv/arg
-need to do error check for non numeric input. realized can't use isDigit
-use atoi to convert string to integer
-error check for value 0-255
-convert integer value to binary (several methods not sure which is most efficient?)
-store the binary values into array[8]

is something incorrect because it sure isn't working as simple as it sounds..

btw can't use <string.h>

You can use isdigit( ) to validate the input - you just have to do it one character at a time. And know when to stop.

Your general algorithm seems sound. The last two steps are really one - as you do the conversion to binary, you will be filling an array. That's the only part of this problem that would be non-trivial.

Can't use <string.h>? Well, you should be using <cstring> anyway.

Sedikit informasi...
Semoga dapat membantu

#ifndef _MSC_VER
#include <string.h>
#else
#include <string>
#endif

//.....
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.