Results 1 to 9 of 9
  1. #1
    That0n3Guy's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Posts
    1,137
    Reputation
    13
    Thanks
    271
    My Mood
    Sleepy

    Tiny bit more advanced calculator (Addition Only atm)

    This should, in theory, allow you to add any amount of numbers together, until, of course, you reach the max value that a unsigned long integer can hold, because then, it will freeze there.

    I wrote this from scratch at school, so don't even try to claim that any of this code is yours.

    You can do whatever you want with the source, it doesn't matter to me.

    Code:
    /////////////////////////////////////////
    ////	Eddie's Ownage Calculator    ////
    /////////////////////////////////////////
    
    #include "stdafx.h"
    #include <iostream>
    #include <string>
    using namespace std;
    void test()
    {
    	cout << "How many numbers?" << endl;
        int num;
        unsigned long int answer = 0;
        int nums;
        cin >> nums;
        cout << endl << "What operation would you like to use?" << endl;
        char choice;
        cin >> choice; 
        switch (choice)
        {
    	case '+':
    		for(int i = 0; i <= nums; i++)
    		{
    			if(i == 1)
    			{
    				cout << "First Number? \n";
    				cin >> num;
    				answer = num + answer;
    			} else if(i >= 2) {
    				cout << "Next Number? \n";
    				cin >> num;
    				answer = num + answer;
    			}
    		}
    		break;
    	case '-':
    		break;
    	case '*':
    		break;
    	case '/':
    		break;
    	}
    	cout << "The answer is: " << answer << endl;
    }
    int main()
    {
    	test();
    	system("pause");
    	return 0;
    }
    If you have any suggestions, tell me. I'll be adding other operations later, since they won't take to long.
    Last edited by That0n3Guy; 11-17-2009 at 06:37 AM.
    Quotes Hall of Fame

    Quote Originally Posted by martijno0o0 View Post
    ok, i got visual basic 2008 and i got some expirients but i need c++ to make hacks rigth?
    so i need c++ and my question is!?¿? where i dontload it? and is c++ a own program or a update for vb08?
    [IMG]https://i660.photobucke*****m/albums/uu327/EddieTheWin/duff.png[/IMG]

  2. #2
    zhaoyun333's Avatar
    Join Date
    Apr 2009
    Gender
    male
    Posts
    396
    Reputation
    11
    Thanks
    1,125
    No offense, but why would someone even want to steal this.
    There are five possible operations for any army. If you can fight, fight; if you cannot fight, defend; if you cannot defend, flee; if you cannot flee, surrender; if you cannot surrender, die." - Sima Yi

  3. The Following User Says Thank You to zhaoyun333 For This Useful Post:

    B1ackAnge1 (11-16-2009)

  4. #3
    zeco's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Location
    Canada
    Posts
    683
    Reputation
    12
    Thanks
    78
    My Mood
    Cynical
    Quote Originally Posted by zhaoyun333 View Post
    No offense, but why would someone even want to steal this.
    Because they are so noobish they don't even know what it is

  5. #4
    rwkeith's Avatar
    Join Date
    Jul 2008
    Gender
    male
    Posts
    457
    Reputation
    11
    Thanks
    79
    My Mood
    Angelic
    I think you can even make your value range longer with "unsigned long long". Never tried it before. It can hold at least 64 bits so it might only work on a 64 bit OS.
    Goals In Life:
    [X] Become an Advanced Member
    [X]Release a tut on mpgh
    [0]Post 300 posts
    [X]Make a working hack
    [X] Learn c++

  6. #5
    why06's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Location
    IBM
    Posts
    4,304
    Reputation
    170
    Thanks
    2,203
    My Mood
    Flirty
    The only reason I would hand program a calculator is if I was trying to calculate extremely precise or extroadinarily large values. That's when it gets interesting, because a double is essentially the largest value you can calculate on a 32 bit machine, so you have to find otherways around it to make calculate these numbers... so that they don't overflow.

    "Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."
    - Dwight D. Eisenhower

  7. #6
    origami7795's Avatar
    Join Date
    Mar 2009
    Gender
    male
    Location
    Illegal Alien's Next Door Neighbor
    Posts
    202
    Reputation
    10
    Thanks
    7
    My Mood
    Busy
    Quote Originally Posted by why06 View Post
    The only reason I would hand program a calculator is if I was trying to calculate extremely precise or extroadinarily large values. That's when it gets interesting, because a double is essentially the largest value you can calculate on a 32 bit machine, so you have to find otherways around it to make calculate these numbers... so that they don't overflow.
    a calculator is very good practice for learning if/else statements, switch case.

    but i see your point, making a calculator just because you want a project is pretty useless.
    [YOUTUBE]<object width="560" height="340"><param name="movie" value="https://www.youtube.com/v/MVchQI1cKwM&hl=en_US&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="https://www.youtube.com/v/MVchQI1cKwM&hl=en_US&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"></embed></object>[/YOUTUBE]

  8. #7
    Hell_Demon's Avatar
    Join Date
    Mar 2008
    Gender
    male
    Location
    I love causing havoc
    Posts
    3,976
    Reputation
    343
    Thanks
    4,320
    My Mood
    Cheeky
    4LL 0F TH1S C4LCULATORZ R B3L00NG 2 M3H!!1

    Good job I guess
    Ah we-a blaze the fyah, make it bun dem!

  9. #8
    why06's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Location
    IBM
    Posts
    4,304
    Reputation
    170
    Thanks
    2,203
    My Mood
    Flirty
    Quote Originally Posted by origami7795 View Post
    a calculator is very good practice for learning if/else statements, switch case.

    but i see your point, making a calculator just because you want a project is pretty useless.
    Yeh it is good practice. Practicing the little things like this will help you to get a good grasps on the concepts. I tried something similar once... I tried to make a chemical formula calculator, but that was before I realized I didn't know shit about chemistry and dropped the course... =/

    "Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."
    - Dwight D. Eisenhower

  10. The Following User Says Thank You to why06 For This Useful Post:

    Hell_Demon (11-17-2009)

  11. #9
    zeco's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Location
    Canada
    Posts
    683
    Reputation
    12
    Thanks
    78
    My Mood
    Cynical
    Quote Originally Posted by why06 View Post
    Yeh it is good practice. Practicing the little things like this will help you to get a good grasps on the concepts. I tried something similar once... I tried to make a chemical formula calculator, but that was before I realized I didn't know shit about chemistry and dropped the course... =/
    Wow...... And i'm guessing you wrote this in java?

    My friend did the exact same thing. Like in java too =0 . . .

    He did it really grossly though. Too much repeating code where loops could have been used, no structure (it was messy as hell), and other such peeves of mine.

Similar Threads

  1. [Release] GoDLY-HaX's MW2 Crosshair: NEW MORE ADVANCED!
    By GodlyHaX in forum Call of Duty 6 - Modern Warfare 2 (MW2) Hacks
    Replies: 72
    Last Post: 03-24-2010, 02:20 AM
  2. [Source Code] Advanced Calculator
    By scimmyboy in forum Visual Basic Programming
    Replies: 3
    Last Post: 02-23-2010, 07:14 PM
  3. MPGH needs to be a bit more informative?
    By dontsassme in forum General
    Replies: 33
    Last Post: 11-17-2009, 08:17 PM
  4. [Tutorial] How to set hotkeys to more advanced hacks.
    By wr194t in forum Visual Basic Programming
    Replies: 13
    Last Post: 05-26-2008, 10:31 AM

Tags for this Thread