Results 1 to 6 of 6
  1. #1
    WeedToThePeople's Avatar
    Join Date
    Jul 2014
    Gender
    male
    Location
    dwm.exe
    Posts
    41
    Reputation
    16
    Thanks
    104
    My Mood
    Aggressive

    Red face Simplest C++ calculator EVAR!

    For this tutorial you need:
    Common C++ knowledge
    A brain (very important)
    And CodeBlocks or Visual Studio


    Here is the code :

     
    #include <iostream>
    #include <windows.h>
    using namespace std;

    //Function prototype
    int solve(int, int, char);

    int main()
    {
    //Declare variables
    int solution, num1, num2;
    char oper;

    //Output
    system ( "color a" );
    cout << " _________________00__________________" <<endl;
    cout << " ________________0000_________________" <<endl;
    cout << " _______________000000________________ " <<endl;
    cout << " ____00_________000000__________00____ " <<endl;
    cout << " _____0000______000000______00000_____ " <<endl;
    cout << " _____000000____0000000___0000000_____ " <<endl;
    cout << " ______000000___0000000_0000000_______ " <<endl;
    cout << " _______0000000_000000_0000000________ " <<endl;
    cout << " _________000000_00000_000000_________ " <<endl;
    cout << " _0000_____000000_000_0000__000000000_ " <<endl;
    cout << " __000000000__0000_0_000_000000000____ " <<endl;
    cout << " _____000000000__0_0_0_000000000______ " <<endl;
    cout << " _________0000000000000000____________ " <<endl;
    cout << " ______________000_0_0000_____________ " <<endl;
    cout << " ____________00000_0__00000___________ " <<endl;
    cout << " ___________00_____0______00__________ " <<endl;
    cout << "--------------Calculator-------------- By: WeedToThePeople" << endl;
    system ( "color 2" );
    cout << "DONT TYPE ANY LETTERS LIKE s BECAUSE THE PROGRAM WILL GO BERSERK!" << endl;
    cout << "Syntax:\n" << endl;
    cout << "1 + 3\n" << endl;
    system ( "color 20" );
    cout << "Operators: +, -, *, /\n" << endl;
    cout << "Equation: ";

    //Input
    cin >> num1 >> oper >> num2;

    //Solve and output
    solution = solve(num1, num2, oper);
    cout << "Answer: " << solution << endl;

    //Pause [until enter key] and exit
    cin.ignore(); //Enter key from last cin may be passed, ignore it.
    cin.get();
    return 0;
    }

    int solve(int num1, int num2, char oper)
    {
    //Switch oper
    switch(oper)
    {
    case '+':
    return num1 + num2;
    case '-':
    return num1 - num2;
    case '*':
    return num1 * num2;
    case '/':
    return num1 / num2;
    default:
    cout << "\nTold you!"<<endl;
    cin >> num1 >> oper >> num2;
    solve(num1, num2, oper);
    }
    }


    Just C+P that into VS or CodeBlocks! DONE
    Don't attack me for making a stupid tutorial some people came here to learn

    NOTE: THIS THING CAN ONLY HANDLE 1 EQUATION AT ONE TIME!

    [HTML]https://www.virustotal.com/en/file/2fc1d965d36a9b6d05d7870c421f476cbb9ffbfc7a0e41887b 62d3c158268ecd/analysis/1414248259/[/HTML] <---VIRUSTOTAL RESULTS 1/54

    <b>Downloadable Files</b> Downloadable Files
    Last edited by WeedToThePeople; 10-25-2014 at 08:46 AM.
    Making hacking tutorials by demand (for Kali Linux) and C++ Game Hacking
     
    Skype- igor_nikolic93

  2. The Following 2 Users Say Thank You to WeedToThePeople For This Useful Post:

    ha4yroooodrigo (12-03-2014),hwywjl521 (01-08-2015)

  3. #2
    殺す必要がある唯一のものは殺されるために準備され人 々である。
    Premium Member
    Hitokiri~'s Avatar
    Join Date
    Oct 2012
    Gender
    female
    Location
    Cancer.
    Posts
    1,201
    Reputation
    24
    Thanks
    937
    My Mood
    Bitchy
    atoX functions work wonderfully.

  4. #3
    ERGaergaergaergaergearg's Avatar
    Join Date
    Apr 2011
    Gender
    male
    Posts
    172
    Reputation
    19
    Thanks
    30
    My Mood
    Amazed
    I would not call this a tutorial. I would not call this learning. I would call this pure copy n paste.

    You have no indent style in your code at all, which makes it very hard to read and looks like pure crap.
    You've just added unnecessary comments which is quite obvious if you have common C++ knowledge. And by that you're calling this a tutorial?

    Not attacking, just some feedback

    Bai
    Last edited by ERGaergaergaergaergearg; 10-25-2014 at 08:44 AM.

  5. #4
    Harava's Avatar
    Join Date
    Sep 2013
    Gender
    male
    Posts
    114
    Reputation
    10
    Thanks
    2,989
    Lol.

    Code:
    #include <stdio.h>
    
    int n1, n2;
    char op;
    
    int Calc(){if(op=='+')return n1+n2; if(op=='-')return n1-n2; if(op=='/')return n1/n2; if(op=='*')return n1*n2; return -1;}
    
    int main()
    {
    	while(op!='q')
    	{
    		printf("Enter Calculation:\n");
    		scanf("%i %c %i", &n1, &op, &n2);
    		printf("\nResult: %i\n", Calc());
    	}
    	return 0;
    }
    This one ain't got weed though... Still, 100x smaller and pure C.
    Recent releases:
    CSPHv3.2




    Code:
    00F38C0E     B8 0610F300    MOV EAX, 00F31006
    00F38C13     C700 208CF300  MOV DWORD PTR DS:[EAX], 00F38C20
    00F38C19     EB FF          JMP SHORT 00F38C1A
    00F38C1B     90             NOP
    00F38C1C     0000           ADD BYTE PTR DS:[EAX],AL
    00F38C1E     0000           ADD BYTE PTR DS:[EAX],AL
    00F38C20     58             POP EAX
    00F38C21    ^EB EB          JMP SHORT 00F38C0E
    Can't see me calling, you hatin'?

  6. #5
    Sixx93's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Posts
    673
    Reputation
    21
    Thanks
    250
    My Mood
    Cool
    Am I wrong or the division between 2 integers will return an integer too? I think that no one will want that.

    Myaybe just add a .f

  7. #6
    Flengo's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    /admincp/banning.php
    Posts
    20,591
    Reputation
    5180
    Thanks
    14,179
    My Mood
    Inspired
    File appears safe.

    /Approved
    I Read All Of My PM's & VM's
    If you need help with anything, just let me know.

     


     
    VM | PM | IM
    Staff Administrator Since 10.13.2019
    Publicist Since 04.04.2015
    Middleman Since 04.14.2014
    Global Moderator Since 08.01.2013
    Premium Since 05.29.2013

    Minion+ Since 04.18.2013

    Combat Arms Minion Since 12.26.2012
    Contributor Since 11.16.2012
    Member Since 05.11.2010


Similar Threads

  1. Browse the Internets with CALCULATOR
    By noobhaxor47 in forum Programming Tutorials
    Replies: 3
    Last Post: 01-29-2009, 12:03 AM
  2. Bestest day evar
    By GirlzWithGunz in forum General
    Replies: 5
    Last Post: 12-28-2008, 01:34 PM
  3. How to make a Basic Addition Calculator + Explenation
    By phoenixraider in forum C++/C Programming
    Replies: 4
    Last Post: 12-21-2008, 01:32 PM
  4. Peace out...... for evar
    By Q in forum General
    Replies: 17
    Last Post: 09-06-2008, 09:45 AM
  5. Mpgh At It's Simplest Form
    By Paroxysm in forum General
    Replies: 31
    Last Post: 07-25-2007, 03:03 AM