C Board  

Go Back   C Board > Platform Specific Boards > Windows Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 11-30-2001, 11:43 PM   #1
Registered User
 
Join Date: Nov 2001
Posts: 4
Thumbs up please read this source code and tell me what is wrong

This is the soruce code for a win32 prog that you enter two numbers and select your operator to go between them and then it outputs and answer. It's under 2K zipped and I appreciate anyone who will take the time to read it! Thanks!
Attached Files
File Type: zip msgbrd.zip (1.7 KB, 28 views)
goof is offline   Reply With Quote
Old 12-01-2001, 03:33 AM   #2
the hat of redundancy hat
 
nvoigt's Avatar
 
Join Date: Aug 2001
Location: Hannover, Germany
Posts: 2,754
>please read this source code and tell me what is wrong

hm... this is your compilers job. It will do it in a minute if you try.
If you don't get what the errormessage means, come back here and post it.
__________________
hth
-nv

She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

When in doubt, read the FAQ.
Then ask a smart question.
nvoigt is offline   Reply With Quote
Old 12-01-2001, 11:48 AM   #3
Registered User
 
Join Date: Nov 2001
Posts: 4
Sorry, I should have been more specific. The program compiles fine, but doesn't work "right" ie how I want it to. I am not asking for any source code, just an explanation of what is wrong. Thanks for your time.
goof is offline   Reply With Quote
Old 12-01-2001, 11:50 AM   #4
the Corvetter
 
Join Date: Sep 2001
Posts: 1,584
How does it "not work right"? What are the symptoms?
__________________
1978 Silver Anniversary Corvette
Garfield is offline   Reply With Quote
Old 12-01-2001, 01:19 PM   #5
Registered User
 
Join Date: Nov 2001
Posts: 4
It doesn't add/subtract/multiply/divide the numbers when you enter two numbers and click a operator button. It gives out a seemingly random number, not the right answer. Here is the exec file, It not virused or anything.
Attached Files
File Type: zip exezip.zip (2.0 KB, 26 views)
goof is offline   Reply With Quote
Old 12-01-2001, 04:41 PM   #6
Banned
 
maes's Avatar
 
Join Date: Aug 2001
Posts: 744
-> make "numone" and "numtwo" static, otherwise they will lose their value.

->your use of GetDlgItemInt is wrong
numone=GetDlgItemInt(hDlg,IDC_NUMONE,NULL,TRUE);

->it is better to check also if you change your operation (+,-,*,/)
Code:
case IDC_PLUS:
case IDC_MINUS:
case IDC_MULTIPLY:
case IDC_DIVIDE:
Calculate(hDlg,numone,numtwo);
break;
one more thing: in your "Calculate" function, check if numtwo is zero. It is safer. press the '/' button before entering a number in numtwo and see what happens
maes is offline   Reply With Quote
Old 12-01-2001, 10:39 PM   #7
Registered User
 
Join Date: Nov 2001
Posts: 4
thanks!

Hey thanks maes, it works right now. I really appreciate it!
goof is offline   Reply With Quote
Old 12-01-2001, 11:49 PM   #8
Unregistered
Guest
 
Posts: n/a
thanks!

Hey thanks maes, it works right now. I really appreciate it!
  Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump


All times are GMT -6. The time now is 08:28 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22