Welcome to Dream.In.Code
Become a C++ Expert!

Join 137,271 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,447 people online right now. Registration is fast and FREE... Join Now!




Boolean Evaluation

 
Reply to this topicStart new topic

Boolean Evaluation

Umbrella
15 Oct, 2006 - 06:10 PM
Post #1

New D.I.C Head
*

Joined: 13 Oct, 2006
Posts: 49


My Contributions
CODE

bool InvalidHex(/*in*/ string hex, int length)
{
    bool returnValue = false;
    Upper(hex,length);

    for (int index = 0; index < length; index ++)
    {
        if(hex[index] != '0'&&'1'&&'2'&&'3'&&'4'&&'5'&&'6'&&'7'&&'8'&&'9'&&'-'&&'A'&&'B'&&'C'&&'D'&&'E'&&'F')
        {
            returnValue = true;
        }
    }

    return returnValue;
}

the upper(hex,length) just makes characers uppercase...

EDIT : Added Code Tags - born2c0de

This post has been edited by born2c0de: 16 Oct, 2006 - 03:42 AM
User is offlineProfile CardPM
+Quote Post

Umbrella
RE: Boolean Evaluation
15 Oct, 2006 - 06:21 PM
Post #2

New D.I.C Head
*

Joined: 13 Oct, 2006
Posts: 49


My Contributions
hahah nmmmmm im a newb
need a hex[index] != after every number. sad.gif
User is offlineProfile CardPM
+Quote Post

born2c0de
RE: Boolean Evaluation
16 Oct, 2006 - 03:49 AM
Post #3

printf("I'm a %XR",195936478);
Group Icon

Joined: 26 Nov, 2004
Posts: 3,914



Thanked: 34 times
Dream Kudos: 2800
Expert In: 80x86 Assembly, C/C++, VB6, VB.NET, C#, J2SE, Win32 API, Reversing

My Contributions
Good to hear that you got where you went wrong.
You can also simplify your code by using the switch..case construct so that you can void typing hex[index] all the time.
User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/4/08 07:58PM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month