|
Read the user's input into a std::string , which will properly null-terminate the char array so that atoi() works.
std::string sInput;
cin >> sInput;
--Mike--
Looks like I picked the wrong week to stop sniffing glue.
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Thank you, I will try this tonight, the pointer looks good.
|
|
|
|
|
The old fashioned trick was to subract ASCII 0 (zero) from the character, e.g.
for ( int j = 0; j< ROWS; j++ ) {<br />
sum += inNum1[j] - '0';<br />
}
You of course need to validate the data, i.e. is it between 0 - 9
If I have seen further it is by standing on the shoulders of Giants. - Isaac Newton 1676
|
|
|
|
|
geralt wrote:
Can anyone suggest what should I do in order to read in as characters and convert them into integers
Why not just:
int foo;
cin >> foo;
On the other hand, the following effectively rules out plain integers:
the whole program should resemble calculator that will add two big numbers let say 16 digits
Perhaps you could use __int64? If not, you better look up a large integer library such as GNU MP or NTL.
|
|
|
|
|
Thank you for advice, I will try this tonight once I come back to my project
|
|
|
|
|
I want to do somehting as soon as all child windows(controls) in a CDialog based window have been created and painted, but obviously I can't do it in the "OnInitDialog" function because "OnInitDialog" is called BEFORE anything is painted. Is there a good way to handle this? Thanks.
|
|
|
|
|
What's your reason for doing this?
A. Riazi
|
|
|
|
|
Use PostMessage() to post a user defined (WM_USER + x) message to your dialog from OnInitDialog(). The message handler function that you create to handle this message will be called as soon as OnInitDialog() has finished it's processing.
CPUA 0x5041
Sonork 100.11743 Chicken Little
"So it can now be written in stone as a testament to humanities achievments "PJ did Pi at CP"." Colin Davies
Within you lies the power for good - Use it!
|
|
|
|
|
hi all,
does anyone know how i can check whether a pointer to a class, say MyClass *pMyPtr actually points to a myClass object?
thanx,
Paul
;)
|
|
|
|
|
this might help:
if (dynamic_cast < MyClass * > ptr)
{
}
-c
A | B - it's not a choice.
|
|
|
|
|
Hi all,
Whats the best way of pinning down memory leaks / corruptions?
I've got one I just can't find - the debugger catches it but after the event and gives me no useful information about the true cause.
So how do you find errors like this:
HEAP[myapp.exe]: HEAP: Free Heap block 1929b0 modified at 192de8 after it was freed
--
The Obliterator
|
|
|
|
|
grab the free trial of Purify or BoundsChecker.
or, find all the places in your code where you modify the contents of something you allocated with new or malloc, and make sure you don't run off the end of that array/object.
-c
A | B - it's not a choice.
|
|
|
|
|
Thanks I grabbed a trial of Purify - it didn't really help with this one as it only spotted the problem after the event and couldn't really pinpoint the source much better than I knew already. It did how ever find a few other problems which I hadn't noticed though!
Anyhow I eventually found it by hand after determining the complicated trigger sequence!
Thanks for your help.
--
The Obliterator
|
|
|
|
|
How can I stop my MDI application from creating a child window at startup??
thx
perseus
|
|
|
|
|
Add the following to your CMyApp::InitInstance() function immediately after the call to ParseCommandLine(cmdInfo):
// DON'T display a new MDI child window during startup!!!
cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;
--
The Obliterator
|
|
|
|
|
Beautiful!!!! thanks for your help.
-perseus
|
|
|
|
|
You can return FALSE from your OnNewDocument() if your main window is not yet visible.
This means that you have to click on New to open a child frame straight after startup.
-Alex
|
|
|
|
|
Hello,
Does anyone can introduce to me a good Resizable Combo box ?
Some of items in my combobox are very long !
I wanna let users to resize the combo list to view all items.
Regards,
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
|
Thanks alot for help
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
How can I get the background color of a normal xp-menu (under the title bar)? GetSysColor(COLOR_MENU) doesn't work, it always returns RGB(255,255,255)
Thx for every reply.
Happosai
--------------------------------------------------
http://www.happosai.tk - only German, I'm so sorry
|
|
|
|
|
RGB(255,255,255) is white, which is the correct color if you're using the default theme.
--Mike--
Looks like I picked the wrong week to stop sniffing glue.
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
No, I'm sorry, but it's not white. Look here:
menu.jpg
Is this really white?
------------------------------------
http://www.happosai.tk
|
|
|
|
|
Oh, OK. The docs say use COLOR_MENUBAR for that color
--Mike--
Looks like I picked the wrong week to stop sniffing glue.
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
I'm sorry, but COLOR_MENUBAR is not defined.
------------------------------------
http://www.happosai.tk
|
|
|
|