|
The question makes non-sense. There is no such thing as decimal value or hexadecimal values. They are values only and this is their REPRESENTATION (so, how you print the values on the screen for example) that is either decimal or hexa.
Now, what you want to do exactly ? You have a string containing a decimal representation of a value and you want to convert it to an hexa string ? Or do you have a value and you want to print it in a string using its hexadecimal representation ?
Is it a managed question or a purely C++ question (then you are in the wrong forum). If its a C++ question, take a look at sprintf and the print format, you can do something like that:
int Value = 10;<br />
char HexaString[100];<br />
sprintf(HexaString,"%x",Value);
|
|
|
|
|
|
Did you read my post or what ?
There is no such thing as integer value or hex value ! They are all the same and stored in a binary format in your machine. It is only the way you represent them that changes ! If you have 24 apples on a table, the number of the apples will stay the same if you say 'I have 24 apples' or if you say 'I have 0x18 apples'. This is just the way you represent your value that is different. The value itself is neither in decimal or hexadecimal format, it is simply a value.
|
|
|
|
|
|
That's absolutely true!
It's the same thing with languages.
Wether you say "Hello, my name is Peter", "Bonjour, mon nom est Peter" or "Hallo, mijn naam is Peter",
it all has the same meaning, except for the fact that you use three different lingo's.
A decimal 15 = a hexadecimal F = a binairy 1111 = an octal 17.
You just use a different way of expressing the same thing.
Well, I guess that's quite clear now.
By the way: sorry for my wrong source yesterday!
Peter
|
|
|
|
|
I don't know what you want since you deleted your messages, but I hope this piece of code
helps.
One thing to know is that the standard representation of values is decimal.
Other possibilities: hex (hexal), bin (binairy), oct (octal).
<br />
#include < iostream ><br />
#include < iomanip ><br />
using namespace std;<br />
<br />
int main()<br />
{<br />
int a;<br />
int b;<br />
<br />
cout << "Please enter a decimal number which this program\nwill convert to a hexal number.\n";<br />
cin >> a; <br />
cout << "\nYour number is " << hex << a << " in hexal.\n\n";<br />
getchar();
<br />
cout << "Please enter a hexal number which this program\nwill convert to a decimal number.\n";<br />
cin >> hex >> b;<br />
cout << "\nYour number is " << dec << b << " in decimal.\n\n";<br />
getchar(); <br />
<br />
return 0;<br />
}<br />
Regards,
Peter
|
|
|
|
|
|
Hmmm...
It seems that way.
No-one's perfect!
|
|
|
|
|
|
what is the code to get the value of a special character in a C++ string. Like getting the 3 character of the string "Hello world" it would be "l".
also
what is the code to make a string all to upper case.
thanks
|
|
|
|
|
None of these questions relate to C++/CLI, which is managed C++ in .NET 2005. A string is an array of characters, so you'd access it as such. How you make a string all upper depends on what sort of string it is. Are you using C style char * ? If so, why aren't you using a string class ? If you're using a string class, it depends on which one you're using.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
foolygoofy26 wrote:
what is the code to make a string all to upper case.
If you are using c++/cli (managed), then use String::ToUpper();
ex:
String ^test = gcnew String ("Upper Sentence");
test = test->ToUpper();
output: UPPER SENTENCE
|
|
|
|
|
hi,
i got an .NET web application using C#,
that app talks to a C++ DLL that is using DAO,
when the first line get executed it throw an exception
, it only executes this line
CDaoWorkspace workspace;<br />
workspace.Open();
does any body have a clew, I know its not recommended to use DAO in any multithreaded application even on the desktop, but this is an legacy application and I want the minimum modification.
Thanks
Lakani
|
|
|
|
|
Hi All,
Could someone explain the steps to
expose my C++/CLI dll to VBA?
Thank you,
Paul
|
|
|
|
|
Hi!
I have three very simple questions:
How can I set the console screen's size?
And how can I set it so that it is maximized immediatly?
And how can I keep the user from re-sizing the console screen?
Thanks in advance!
Peter
ERROR
Keyboard not found. Press any key to continue.
"Which one is the any key?" - Homer Simpson
|
|
|
|
|
Which .Net Framework you are using?
|
|
|
|
|
Well, what I'm talking about is the standard DOS console
which is used for standard C/C++ output.
Go blame those who didn't give standard C/C++ a message board of its own,
but I still do need to post my question somewhere.
Anyways, I hope you can help!
Peter
|
|
|
|
|
This post can go to the Visual C++ Forum since Visual C++ is Microsoft version of the ISO C++ standard. C++/CLI refers to another standard and has its own syntax and framework.
|
|
|
|
|
That's odd since my questions regarding standard C++
were always rejected at the Visual C++ board...
But I'll give it a go anyway.
Regards
|
|
|
|
|
Actually, if you are working in Windows with C++, it would actually be a Win32 question (Operating system specific).
|
|
|
|
|
I'm now a time work with C++, but now I wil work with color.
as so:
color(int X,int Y, int Red, int Green, int Blue);
great,
marc
|
|
|
|
|
What is your question ? Is it a C++/CLI question, or a C++ question ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
It is a C++ question.
and the question is: "is it possible to make a function that gen use as:
color(int X, int Y, Int Red, int green, int bleu);
X = 0 to 600 //width
Y = 0 to 800 // height
Red, green and bleu = 0 to 255 //color
Is some header-file that I can use?
Great,
Marc
1 day, 24 hours, 1440 minutes, 86400 seconden and then start the next day.
|
|
|
|
|
Err... And what is the question precisely ? You want to display a pixel at the specified location (X and Y) to the specified color (Red, Green, Blue) ? Then, it will depend strongly of what kind of application you use. Is it a plain console application or a Win32 application (with the MFC or not).
Please be more specific when asking questions.
|
|
|
|
|
I use win32 application, that looks like MS DOS.
“And what is the question precisely ? You want to display a pixel at the specified location (X and Y) to the specified color (Red, Green, Blue) ?” and this is right.
I’m searching for a include that I can use for that.
Great,
Marc
1 day, 24 hours, 1440 minutes, 86400 seconden and then start the next day.
|
|
|
|