I want to make a calculator

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

I want to make a calculator
  1. Unread #1 - Sep 13, 2011 at 6:43 PM
  2. SmokeHut
    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

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

    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.
     
  3. Unread #2 - Sep 14, 2011 at 1:44 AM
  4. BotsInc
    Joined:
    Aug 12, 2011
    Posts:
    78
    Referrals:
    0
    Sythe Gold:
    0

    BotsInc Member

    I want to make a calculator

    Give me a pm of what exactly it has to do and ill write it for you.
     
  5. Unread #3 - Sep 14, 2011 at 7:20 AM
  6. blindkilla
    Joined:
    Jun 22, 2005
    Posts:
    1,896
    Referrals:
    0
    Sythe Gold:
    6
    Discord Unique ID:
    282000633404456960
    Discord Username:
    sogord

    blindkilla Guru
    $25 USD Donor New

    I want to make a calculator

    You could pretty much use any language to make this.
     
  7. Unread #4 - Sep 14, 2011 at 8:07 AM
  8. wackywamba
    Joined:
    Jul 14, 2005
    Posts:
    1,358
    Referrals:
    0
    Sythe Gold:
    1

    wackywamba Guru

    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.
     
  9. Unread #5 - Sep 14, 2011 at 8:22 AM
  10. SmokeHut
    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

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

    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.
     
  11. Unread #6 - Sep 14, 2011 at 8:57 AM
  12. wackywamba
    Joined:
    Jul 14, 2005
    Posts:
    1,358
    Referrals:
    0
    Sythe Gold:
    1

    wackywamba Guru

    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.
     
  13. Unread #7 - Sep 14, 2011 at 9:02 AM
  14. SmokeHut
    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

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

    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.
     
  15. Unread #8 - Sep 14, 2011 at 9:13 AM
  16. wackywamba
    Joined:
    Jul 14, 2005
    Posts:
    1,358
    Referrals:
    0
    Sythe Gold:
    1

    wackywamba Guru

    I want to make a calculator

    Added you.
     
  17. Unread #9 - Sep 14, 2011 at 11:02 AM
  18. wackywamba
    Joined:
    Jul 14, 2005
    Posts:
    1,358
    Referrals:
    0
    Sythe Gold:
    1

    wackywamba Guru

    I want to make a calculator

  19. Unread #10 - Sep 14, 2011 at 11:08 AM
  20. Terrankiller
    Joined:
    May 7, 2005
    Posts:
    1,286
    Referrals:
    1
    Sythe Gold:
    1

    Terrankiller Ex-Administrator
    Retired Administrator Visual Basic Programmers

    I want to make a calculator

    Lol cool :p.
     
  21. Unread #11 - Dec 4, 2011 at 3:24 PM
  22. sp for real
    Joined:
    Nov 17, 2011
    Posts:
    75
    Referrals:
    0
    Sythe Gold:
    0

    sp for real Member

    I want to make a calculator

    just use javascript for this
     
  23. Unread #12 - Dec 7, 2011 at 2:32 PM
  24. FeCoola
    Joined:
    Sep 13, 2010
    Posts:
    727
    Referrals:
    2
    Sythe Gold:
    0

    FeCoola Apprentice
    Banned

    I want to make a calculator

    Wow that dice host thing is really cool lol
     
  25. Unread #13 - Dec 8, 2011 at 10:54 PM
  26. Imagine
    Joined:
    May 31, 2010
    Posts:
    3,375
    Referrals:
    4
    Sythe Gold:
    5
    Chess Master

    Imagine Grand 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
     
  27. Unread #14 - Dec 18, 2011 at 4:49 PM
  28. Artifice
    Joined:
    Dec 18, 2011
    Posts:
    49
    Referrals:
    0
    Sythe Gold:
    0

    Artifice Member
    Banned

    I want to make a calculator

    There's going to be a syntax error correct, try replacing the ''x''.
     
  29. Unread #15 - Dec 18, 2011 at 11:59 PM
  30. SaraClever
    Joined:
    Dec 18, 2011
    Posts:
    2
    Referrals:
    0
    Sythe Gold:
    0

    SaraClever Newcomer

    I want to make a calculator

    It's very easy, you can use C Language for this calculator program
     
  31. Unread #16 - Mar 23, 2012 at 1:58 AM
  32. lololroflcopter
    Joined:
    Dec 28, 2011
    Posts:
    21
    Referrals:
    0
    Sythe Gold:
    0

    lololroflcopter Newcomer

    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.
     
  33. Unread #17 - May 10, 2012 at 9:33 AM
  34. Darwin
    Joined:
    Jul 9, 2009
    Posts:
    176
    Referrals:
    0
    Sythe Gold:
    0

    Darwin Active Member

    I want to make a calculator

    dont forget the ; behind the equations haha
     
  35. Unread #18 - May 14, 2012 at 7:16 PM
  36. Cyped
    Joined:
    May 14, 2012
    Posts:
    14
    Referrals:
    0
    Sythe Gold:
    0

    Cyped Newcomer

    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]
     
  37. Unread #19 - May 14, 2012 at 7:19 PM
  38. RSKingdom-2012
    Joined:
    Apr 12, 2012
    Posts:
    563
    Referrals:
    0
    Sythe Gold:
    0

    RSKingdom-2012 Forum Addict
    Banned

    I want to make a calculator

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

Users viewing this thread
1 guest


 
 
Adblock breaks this site