Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QBasic Program Help
#1
How do I create a simple calculator that adds, subtracts, multiplies and divides. The program should print and continue until -1 is entered. Thank You
Reply
#2
You pay attention in class.

You open QB.

You code it.

You hand it in and pass.



Really simple actually.
Reply
#3
Oh, don't listen to her.

I recommend utilizing a High resolution model (You should be able to make one of these in 3d Studio Max) to emulate a visual calculator model. Then all you need to do is extrapolate the mouse button position into a 3d position relative to the model to retrieve the keypresses. Naturally, you'll want to write a poly rasterizer to do this, but that shouldn't take more than a few months if you work hard at it. Then you'll need to implement a dynamic texture and a font renderer so you can draw the numbers displayed on the calculator without requring a second rendering pass.

After that infastructure is in place, I guarantee, you'll have no problems. Don't hesitate to call! Big Grin
Reply
#4
Ya, of course I agree with SJ Zero. But wow. He did it the simple way. How do you do that SJ Zero? I could never get my code that simple.

Wait you said you want to extrapolate the mouse button into a 3D position realtive to the model to retrive the keypresses. Would a perpendicular plane with the height as the model's surface be better to retrieve the keypresses? I mean then you could have the mouse still in relative 2D coordinates instead of 3D and that would be easier to convert to the status of the lib and the model. But then if you had irregular surfaces on the model you would have the mouse inside them which would be bad for rasterization. I guess you thought of that..heh lol :wink:
i]"But...it was so beautifully done"[/i]
Reply
#5
what are you guys talking about? he's not trying to write a program silly, he even said

Quote:How do I create a simple calculator that adds, subtracts, multiplies and divides.

so all he wants to do is build one. just go on over to radioshack, they've got all you need.
ttp://m0n573r.afraid.org/
Quote:quote: "<+whtiger> you... you don't know which way the earth spins?" ... see... stupidity leads to reverence, reverence to shakiness, shakiness to... the dark side
...phear
Reply
#6
Never thought about that dumbledore.

Though:
Quote:-1 is entered.
There is no such thing as negative entities


What is this -1 you speak of qbasichelp?
Reply
#7
I thought numbers were from 0 to inf. heh...destroyed all my thoughts.

I looked it up online: appently -1 is something called a negitive number.

I couldn't figure this out but here's a diagram:
-4, -3, -2, -1, 0, 1, 2, 3, 4

Could somebody explain it...very confusing... :-?
i]"But...it was so beautifully done"[/i]
Reply
#8
You forgot about rendering the raytracing engine! After you initialize the trigometric variables, you then initiate the optimization algorithems. Following, you must use some assembly to hack into the computer to enable EMS and XMS memory, which will allow you to have enough ram to render the graphics. After you successfully initialize EMS and XMS (If you fail here, you must use another hack to access the internal BIOS and rewrite it to enable legacy support) There, you must initiate a double-off screen buffer, followed by a pixel blitter, as qb's pset is too slow. Once you have successfully rendered some raytracing, you must poll for a keystroke. If no keystroke is entered, you should use the out and inp commands to simulate a virtual keystroke. To do this you must set up an internal loop which will exit when the keystroke variable detects a key or two being pressed. It is best to code a multikey handler, just in case the user has big fingers and ends up hitting 2 or more keys at the same time. Once the internal structure loop has confirmed the keystroke, you must then set up a series of logical statements to determine if the keystroke is valid. (i.e. the keystroke is within a certain scan code range.) Once the keystroke is verified, you must access the sound card and then you must successfully interface with the sound card, making sure you get the right frequency and ports. Then you must use the SOUND command to play a small medely such as "row row your boat." Once this has been done successfully (If it hasn't, you must then access the windows api to create a popup message to inform the user of the failure to play the song, and offer to use the internal speakers) You must use assembly to process the command they want. For example, if they press the 3 key, you must MOV the variable into an assembly variable. If they press +, you must use the ADD command to integrate the variable entered prior to the variable that will be the latter to be entered. If they want to multiply, you must set up a controlled internal loop, and use assembly to add a variable to itself by variable2 times. once the math calculation has been completed, you must then reboot your computer to finish the process, as some of the code must happen before some windows utilities are running. Before they reboot though, you must use access the hard drive and store the contents of the variables and the product/sum to an external file. Then use OUT to reboot the computer. Once the computer has been rebooted, access the bios by pressing F12, F1, F2, DEL or INS. Any of these keys could open the bios, or maybe even a different key. Once you have access the bios, you must disable the keyboard to continue. Once you have rebooted again and logged back into windows, you should re-initiate the calculator-emulation program. Load the variables by accessing the external file VIA OPEN as BINARY. once the files have been loaded, you must output the equation to the double buffer, followed by an output to the screen. After all, you DO want flickerless performance, don't you? To do this, use the DEF SEG command to change the SEGMENT to the double buffer. From there, use the poke command to POKE the variables onto the buffer. However, you cannot use numbers or symbols... you must use the scan codes to properly do this. From there, you must initiate a different screen mode: screen 13 should suffice. Use some assembly to initiate screen 13. After screen 13 has been initiated, use put to put the equation and the answer to the screen.

Wow... i can't believe i wrote all that. :barf: easy, ain't it?
Jumping Jahoolipers!
Reply
#9
:o I'm going to die, too much too late at night.
i]"But...it was so beautifully done"[/i]
Reply
#10
barok wins the prize though.

That was some serious shiznitz! Big Grin
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)