Adblock breaks this site

I want to make a calculator

Discussion in 'Programming General' started by SmokeHut, Sep 13, 2011.

  1. SmokeHut

    SmokeHut Great men grow tired of contentedness.
    $100 USD Donor New

    Joined:
    Aug 17, 2011
    Posts:
    1,504
    Referrals:
    0
    Sythe Gold:
    112
    Discord Unique ID:
    865859811747692554
    Discord Username:
    Okesseril#7961
    Gohan has AIDS Sythe's 10th Anniversary
    I want to make a calculator

    I specific calculator working under this sort of format.

    x,y & z

    x = Input from user

    y = x*2-z

    z = x*2/10

    X is an input and Y & Z are outputs generated from the input to X.

    I don't know a lot about c++ but is this the right software i should be using?

    before you tell me to use Excell I want to mass produce this.
     
  2. BotsInc

    BotsInc Member

    Joined:
    Aug 12, 2011
    Posts:
    78
    Referrals:
    0
    Sythe Gold:
    0
    I want to make a calculator

    Give me a pm of what exactly it has to do and ill write it for you.
     
  3. blindkilla

    blindkilla Guru
    $25 USD Donor New

    Joined:
    Jun 22, 2005
    Posts:
    1,896
    Referrals:
    0
    Sythe Gold:
    6
    Discord Unique ID:
    282000633404456960
    Discord Username:
    sogord
    I want to make a calculator

    You could pretty much use any language to make this.
     
  4. wackywamba

    wackywamba Guru

    Joined:
    Jul 14, 2005
    Posts:
    1,358
    Referrals:
    0
    Sythe Gold:
    1
    I want to make a calculator

    Code:
    #include <iostream>
    using namespace std;
    
    void calc();
    float x, y, z;
    
    int main ()
    {
    	cout << "Input X: ";                               //output
    	cin >> x;                                          //waits for input
    	
    	z = x*2/10;
    	y = x*2-z;                                          
    
    	cout << "Y: " << y << endl << "Z: " << z << endl;  //displays answers
    	
    	system ("pause");  //Remove if you happen to be compiling this in Linux
    	return 0;
    }
    
    You could do this in any language you like, the only thing is that your 'y' equation is dependent on the 'z' equation and as C++ is sequential, you need to do your 'z' function first.

    Take a look at my programming help thread in my signature if you need more help.
     
  5. SmokeHut

    SmokeHut Great men grow tired of contentedness.
    $100 USD Donor New

    Joined:
    Aug 17, 2011
    Posts:
    1,504
    Referrals:
    0
    Sythe Gold:
    112
    Discord Unique ID:
    865859811747692554
    Discord Username:
    Okesseril#7961
    Gohan has AIDS Sythe's 10th Anniversary
    I want to make a calculator

    I basically want it so that you enter X and automatically y&z are outputs, without the pressing of buttons etc.
     
  6. wackywamba

    wackywamba Guru

    Joined:
    Jul 14, 2005
    Posts:
    1,358
    Referrals:
    0
    Sythe Gold:
    1
    I want to make a calculator

    How do you plan on checking when the input has been entered?

    Could you explain the situation a bit more fully, because the practical application of this seems futile.

    Although, I do have a feeling you'd be better off doing this in an alternative language. I could make a Java GUI that does this for you in literally 5 minutes if you can just explain it a bit better.
     
  7. SmokeHut

    SmokeHut Great men grow tired of contentedness.
    $100 USD Donor New

    Joined:
    Aug 17, 2011
    Posts:
    1,504
    Referrals:
    0
    Sythe Gold:
    112
    Discord Unique ID:
    865859811747692554
    Discord Username:
    Okesseril#7961
    Gohan has AIDS Sythe's 10th Anniversary
    I want to make a calculator

    Basically I want this

    [​IMG]

    A calculator for hosts.

    works out from the wager x2 then minus the hosts keep ( 10% )

    I want it to be similar to this and you add in usernames from both duelers to keep track of them. Like i said in my OP I don't know pretty much anything about programming and am not aware of which language is best.
     
  8. wackywamba

    wackywamba Guru

    Joined:
    Jul 14, 2005
    Posts:
    1,358
    Referrals:
    0
    Sythe Gold:
    1
    I want to make a calculator

    Added you.
     
  9. wackywamba

    wackywamba Guru

    Joined:
    Jul 14, 2005
    Posts:
    1,358
    Referrals:
    0
    Sythe Gold:
    1
    I want to make a calculator

  10. Terrankiller

    Terrankiller Ex-Administrator
    Retired Administrator Visual Basic Programmers

    Joined:
    May 7, 2005
    Posts:
    1,286
    Referrals:
    1
    Sythe Gold:
    1
    I want to make a calculator

    Lol cool :p.
     
  11. sp for real

    sp for real Member

    Joined:
    Nov 17, 2011
    Posts:
    75
    Referrals:
    0
    Sythe Gold:
    0
    I want to make a calculator

    just use javascript for this
     
  12. FeCoola

    FeCoola Apprentice
    Banned

    Joined:
    Sep 13, 2010
    Posts:
    727
    Referrals:
    2
    Sythe Gold:
    0
    I want to make a calculator

    Wow that dice host thing is really cool lol
     
  13. Imagine

    Imagine Grand Master

    Joined:
    May 31, 2010
    Posts:
    3,375
    Referrals:
    4
    Sythe Gold:
    5
    Chess Master
    I want to make a calculator

    I'm not sure about the code for c++, but for c you could do this:

    Code:
    (After all the stdio.h stuff)
    
    main(){
      float x , y , z; 
      
      printf("Please enter x\n");
      scanf("%f" , &x);
      z = x * 2/10
      y = x*2 - z
      printf("Y = %f , Z = %f" , y , z);
    }
    
    I'm pretty sure theres going to be a syntax error somewhere, i'm sorta rusty :p
     
  14. Artifice

    Artifice Member
    Banned

    Joined:
    Dec 18, 2011
    Posts:
    49
    Referrals:
    0
    Sythe Gold:
    0
    I want to make a calculator

    There's going to be a syntax error correct, try replacing the ''x''.
     
  15. SaraClever

    SaraClever Newcomer

    Joined:
    Dec 18, 2011
    Posts:
    2
    Referrals:
    0
    Sythe Gold:
    0
    I want to make a calculator

    It's very easy, you can use C Language for this calculator program
     
  16. lololroflcopter

    lololroflcopter Newcomer

    Joined:
    Dec 28, 2011
    Posts:
    21
    Referrals:
    0
    Sythe Gold:
    0
    I want to make a calculator

    Said it was solved, but to be honest, the program can be written in just about any language. Not too difficult. The guy that solved it with Java was probably just more comfortable with Java.
     
  17. Darwin

    Darwin Active Member

    Joined:
    Jul 9, 2009
    Posts:
    176
    Referrals:
    0
    Sythe Gold:
    0
    I want to make a calculator

    dont forget the ; behind the equations haha
     
  18. Cyped

    Cyped Newcomer

    Joined:
    May 14, 2012
    Posts:
    14
    Referrals:
    0
    Sythe Gold:
    0
    I want to make a calculator

    Do not use system("PAUSE"); as it's slow and OS-dependant. Replace it with cin.get(); which carries the same function but faster and doesn't depend on your operating system. Seriously, only use system when you're testing a program or messing around, not in any serious application.

    Code:
    #include <iostream>
    
    using namespace std;
    
    int main()
    {
     	int loop = 0;
     	int x;
     	int y;
    	int z;
     	
     	cout << "Calculator" << endl;
     	
     	while (loop !=1) {
    		  cout << "Wager = ";
    		  cin >> x;
    		  z = (x*2)/10;
              y = (x*2)-z;
    		  cout << "\nWinner receives = " << y << "." << endl;
    		  cout << "You receive = " << z << ".\n" << endl;
        }
        return 0;
    }
    
    Compile + run in console. Loops after each input.

    Very simply done, some things were declared when they didn't need to be. But as you seem to be incapable of creating a C++ calculator, it's marked out for you.

    Result:

    [​IMG]
     
  19. RSKingdom-2012

    RSKingdom-2012 Forum Addict
    Banned

    Joined:
    Apr 12, 2012
    Posts:
    563
    Referrals:
    0
    Sythe Gold:
    0
    I want to make a calculator

    ^^ That is well done.
     
< Help with starting an rsbot In C | Question about IRC >


 
 
Adblock breaks this site