Well in VB6 they use Chr()
example:
Do
sChar = Chr(GetRandomNumber())
Loop While sChar = Chr(34)
Just wondering if there is a similar function in c++?
Well in VB6 they use Chr()
example:
Do
sChar = Chr(GetRandomNumber())
Loop While sChar = Chr(34)
Just wondering if there is a similar function in c++?
Well in VB6 they use Chr()
example:
Do sChar = Chr(GetRandomNumber()) Loop While sChar = Chr(34)
Just wondering if there is a similar function in c++?
Its not necessary to do that in C++ or C. A char can be freely used as either an integer or a character. Both the following are correct (equivalent). while( sChar == 34)
or while( sChar == '\"')
Ancient Dragon said it all. char in C/C++ actually is a 8-bits integer ranging from 0 to 255. So you can write something like this:
for( sChar = rand()%256; sChar == 34; sChar = rand()%256);
>char in C/C++ actually is a 8-bits integer ranging from 0 to 255.
While that may be true on your PC, C and C++ don't require char to be an 8-bit type. Further, vanilla char is allowed to be either signed or unsigned (the choice is made by your compiler), in which case even an 8-bit char may not have the range you specified.
>char in C/C++ actually is a 8-bits integer ranging from 0 to 255.
While that may be true on your PC, C and C++ don't require char to be an 8-bit type. Further, vanilla char is allowed to be either signed or unsigned (the choice is made by your compiler), in which case even an 8-bit char may not have the range you specified.
I have been defeated.... *waving white flag*.
Yep, there was a discussion on that not so long ago on the last few posts. http://www.daniweb.com/forums/thread130222.html
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.