» Site Navigation | | | » Advertisement | | | » Recent Threads | | | | | | | Froze-owned 11-03-2008 08:32 PM Today 07:27 PM 15 Replies, 314 Views | | | |  | |  | C++ Console Calculator |  |
08-20-2008, 08:56 PM
|
#1 (permalink)
|
Join Date: Dec 2006 Location: Preston Age: 15 Posts: 2,726
GPoints: 1,351 Rep Power: 9 | C++ Console Calculator Code: //Connor's calculator. OMG IT'S SO COMPLICATED!??!?! No.
#include <iostream.h>
#include <windows.h>
void main()
{
//variables
long Num1;
long Num2;
long final;
char Buffer[9];
cout << "Enter your first number: "<< endl;
cin >> Num1;
cout << "Enter your second number: " << endl;
cin >> Num2;
cout << "Say what you want to do (+, -, / or *) " << endl;
cin >> Buffer;
if ( lstrcmp( Buffer, "+" ) == 0 )
{
final = Num1+Num2;
}
if ( lstrcmp( Buffer, "-" ) == 0 )
{
final = Num1-Num2;
}
if ( lstrcmp( Buffer, "*" ) == 0 )
{
final = Num1*Num2;
}
if ( lstrcmp( Buffer, "/" ) == 0 )
{
final = Num1/Num2;
}
cout << "The final answer is: " << final << endl;
} It's easy stuff but it's the next step up from "Hello World".
I had trouble finding the stuff to learn this, so I thought I'd post it.
__________________ Formerly Connor | |
| |  |
08-20-2008, 08:58 PM
|
#2 (permalink)
| Resident Psychopath.
Join Date: Nov 2006 Location: fewmitz@live.com Posts: 5,378
GPoints: 2,485 Rep Power: 17 | You didn't even make a GUI!
I know really basic C, if you need help, just FYI. | |
| |
08-20-2008, 09:25 PM
|
#3 (permalink)
|
Join Date: Dec 2006 Location: Preston Age: 15 Posts: 2,726
GPoints: 1,351 Rep Power: 9 | Quote:
Originally Posted by Fewmitz You didn't even make a GUI!
I know really basic C, if you need help, just FYI. | What?
This is console C++.
If you want to do GUI's you should use C# with functions from DLLs using C++
__________________ Formerly Connor | |
| |
08-21-2008, 05:37 AM
|
#4 (permalink)
|
Join Date: Feb 2007 Posts: 3,781
GPoints: 6,413 Rep Power: 21 | elseifs = proper way of doing it
or maybe you can use case too. | |
| |
08-21-2008, 05:38 AM
|
#5 (permalink)
| Resident Psychopath.
Join Date: Nov 2006 Location: fewmitz@live.com Posts: 5,378
GPoints: 2,485 Rep Power: 17 | Quote:
Originally Posted by Connor What?
This is console C++.
If you want to do GUI's you should use C# with functions from DLLs using C++ | I know what it is.
I also know the, you know, gooder way of doing it. | |
| |
08-21-2008, 05:51 AM
|
#6 (permalink)
|
Join Date: Dec 2006 Location: Preston Age: 15 Posts: 2,726
GPoints: 1,351 Rep Power: 9 | Quote:
Originally Posted by Fewmitz I know what it is.
I also know the, you know, gooder way of doing it. | Gooder?
__________________ Formerly Connor | |
| |
08-21-2008, 05:55 AM
|
#7 (permalink)
| hi fucktard
Join Date: Aug 2008 Location: anywhere hate runs rampant Posts: 514
GPoints: 1,926 Rep Power: 2 | holy fuck connor. you know C++ at 15!!!!!!!!!!!!! i was learning fucking basic languages at 15. i still dont have have C++ down.
__________________ 
if my fucking link to my menu doesnt work heres the direct link
(copy and paste in address bar) http://www.freewebs.com/terinuptrash/menue/sig.swf and ive decided to revise my current top friends on myspace, so you guys are allowed on it now. i love my .BloodyNightmare <3 o-bby | |
| |
08-21-2008, 05:58 AM
|
#8 (permalink)
|
Join Date: Feb 2007 Posts: 3,781
GPoints: 6,413 Rep Power: 21 | Quote:
Originally Posted by terinuptrash holy fuck connor. you know C++ at 15!!!!!!!!!!!!! i was learning fucking basic languages at 15. i still dont have have C++ down. | He barely knows it, calm down.
Last edited by |G3|; 08-21-2008 at 06:02 AM.
| |
| |
08-21-2008, 06:02 AM
|
#9 (permalink)
|
Join Date: Oct 2006 Location: New Hampshire? Posts: 6,830
GPoints: 282 Rep Power: 20 | Quote:
Originally Posted by terinuptrash holy fuck connor. you know C++ at 15!!!!!!!!!!!!! i was learning fucking basic languages at 15. i still dont have have C++ down. | He made a calculator.
__________________ 
<3 Li' 
Hatz =D | |
| |
08-21-2008, 06:03 AM
|
#10 (permalink)
| hi fucktard
Join Date: Aug 2008 Location: anywhere hate runs rampant Posts: 514
GPoints: 1,926 Rep Power: 2 | Quote:
Originally Posted by |G3| He barely knows, calm down. | still. C++ is a huge language and its kinda intimidating. if i was 15 and i saw how huge C++ is, i would back down and not even attempt to learn it.
but this kinda looks like something to have to do with a class project or something. so its not as impressive. and i see your point
__________________ 
if my fucking link to my menu doesnt work heres the direct link
(copy and paste in address bar) http://www.freewebs.com/terinuptrash/menue/sig.swf and ive decided to revise my current top friends on myspace, so you guys are allowed on it now. i love my .BloodyNightmare <3 o-bby | |
| |  | | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | | | | Thread Tools | | | | Display Modes | Linear Mode |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | |