Please test my calculator prog

This is a discussion on Please test my calculator prog within the Game Programming forums, part of the General Programming Boards category; Can you people please tell me what you think about this "game"? It's a basic calculator done in Console. It ...

  1. #1
    I am the worst best coder Quantrizi's Avatar
    Join Date
    Mar 2002
    Posts
    644

    Please test my calculator prog

    Can you people please tell me what you think about this "game"? It's a basic calculator done in Console. It was done in MSVC++ 6.0 Intro. Version. thanks.

    P.S.: If alot of people like it (or atleast a majority), I'll release the source.
    Attached Files Attached Files

  2. #2
    RoD
    RoD is offline
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    good job man

    have a cout <<"\n"; after your options so the user choice isn't right under the options list

  3. #3
    I am the worst best coder Quantrizi's Avatar
    Join Date
    Mar 2002
    Posts
    644
    Originally posted by Ride -or- Die
    good job man

    have a cout <<"\n"; after your options so the user choice isn't right under the options list
    Thnx. Ok, thnx 4 the advice.

  4. #4
    RoD
    RoD is offline
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    The reason i say this is to help make it flow better in terms of reading. I personaly would go one step further and have a prompt.

    instead of

    cout<<"\n";

    u could use:

    cout<<"\nEnter Choice: ";

    they would see

    Enter Choice:

  5. #5
    I am the worst best coder Quantrizi's Avatar
    Join Date
    Mar 2002
    Posts
    644
    Ok, here's the update. Just fixed what you said, and the version. I also added a title to it. Plus, the source is with it. Hopefully it'll help people out, or you people can help me out on how to optimize or whatnot (I'll give credit). Thanks.
    Attached Files Attached Files

  6. #6
    RoD
    RoD is offline
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    my quick suggestion implemented: (i'll look it over carefully tommorow and see what i notice : ) )

    Code:
    void begin()
    {
    	system("cls");
    	header();
    	cout << "Welcome to Calculator v"<<calculator.version;
    	cout << "."<<calculator.extension <<" "<<calculator.nversion<<"!\n";
    	cout << "\nPlease select an option:\n";
    	cout << "1] Multiply\n2] Divide\n3] Add\n4] Subtract\n5] Exit|Quit\n";
    
    	cout << "\nEnter Choice: "; //added by RoD
    
    	cin  >> pick.choice;

  7. #7
    Lead Moderator kermi3's Avatar
    Join Date
    Aug 1998
    Posts
    2,595
    Nice....now add factorial
    Kermi3

    If you're new to the boards, welcome and reading this will help you get started.
    Information on code tags may be found here

    - Sandlot is the highest form of sport.

  8. #8
    I am the worst best coder Quantrizi's Avatar
    Join Date
    Mar 2002
    Posts
    644
    Originally posted by kermi3
    Nice....now add factorial
    Thanks RoD, I'll add that.

    Kermi3-->-->I'm workin on it! *j/p*. But yea, I'm gonna add more in tomorrow, and maybe it'll be better than micro$oft's calc....*come to think about it, counting w/ your fingers is better than using micro$oft's calc*

  9. #9
    RoD
    RoD is offline
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    I made a pretty sweet calc in VB last year that was everything that MS's is with better interface and more options, damned if i can't find my projects cd from VB...

  10. #10
    I am the worst best coder Quantrizi's Avatar
    Join Date
    Mar 2002
    Posts
    644
    Cool. I hope to do that when I get the hang of Win32 stuff in DirectX.

  11. #11
    RoD
    RoD is offline
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    thats cool man, i gotta admit, i h8 vb and i am developing a love for C++, but GOD do i miss the EASE of VB gui :P

    lol aight i'm out for the nite.

  12. #12
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    tsk tsk ... make sure that when the user selects the divide option, that the second thing entered (the number its dividing the first number by) is not 0! eg,,
    Code:
    ////////////////////////////////////////////////
    //Name:  Divide()
    //Desc:  The division function
    ///////////////////////////////////////////////
    void divide()
    {
    	system("cls");
    	header();
    	cout << "Enter the first value you wish to divide: ";
    	cin  >> a; // the first value to be divided
    	
    	cout << "\nThank you.  Enter another value: ";
    	cin  >> b; // the second value to be divided
    	
    	while(b = 0)
    	{
    		cout << "Please enter a number other than 0 please: ";
    		cin >> b;
    	}
    	da = a / b;// ma equals the product of a divided by b
    	
    	//  Give out the product and ask the user a few q's
    	cout << "\nThe division of the given numbers is: "<<da<<"\n";
    	cout << "\n\n1] Do more division\n"
    		"2] Return to main menu\n3] Quit\n\n";
    	cin  >> pick.choice;
    	//  If the user presses '1', then redo the division process
    	if(pick.choice == 1)
    		multiply();
    	
    	//  If the user presses '2', then start the game over
    	else if(pick.choice == 2)
    		begin();
    	
    	//  If the user presses anything else, then quit and exit the game
    	else
    		exit(1);
    }

  13. #13
    I am the worst best coder Quantrizi's Avatar
    Join Date
    Mar 2002
    Posts
    644
    Thanks face_master. I forgot about that. I'm planning on uploading a new version later on today (It'll probably be on my website). Thnx RoD.

  14. #14
    I am the worst best coder Quantrizi's Avatar
    Join Date
    Mar 2002
    Posts
    644
    This is a new version of the calculator. It now adds the previous stuff that what said here, and now also has a new option to figure the area of a circle. There is a slight bug (warning actually) which states:
    main.cpp(34) : warning C4305: 'initializing' : truncation from 'const double' to 'float'
    I don't know how to fix this one, so any help would be appreciated. This deals with PI.
    Attached Files Attached Files

  15. #15
    RoD
    RoD is offline
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    truncation from 'const double' to 'float'
    I don't know how to fix this one, so any help would be appreciated. This deals with PI.


    it means the double is being changed to a float.

    The double is "higher" then the float if u will, so its called "demoting".

    heres a lil example of pro/demot'n:

    promoting -

    int example;
    int final;

    final = double(example); // example is now a double.

    Demoting -

    double example;
    int final;

    final = int(example); // Example is now a integer.


    Hope this helps! The warning is just lettingu know that this is happening, it won't hurt anything.

Page 1 of 5 12345 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Integer Emulation
    By Elysia in forum C++ Programming
    Replies: 31
    Last Post: 03-18-2008, 01:03 PM
  2. undefined reference
    By 3saul in forum Linux Programming
    Replies: 12
    Last Post: 08-23-2006, 05:28 PM
  3. C++ Operator Overloading help
    By Bartosz in forum C++ Programming
    Replies: 2
    Last Post: 08-17-2005, 12:55 PM
  4. MSVC Template Constructor/Assignment Errors
    By LuckY in forum Windows Programming
    Replies: 3
    Last Post: 07-22-2005, 02:57 PM
  5. Why is my program freezing?
    By ShadowMetis in forum Windows Programming
    Replies: 8
    Last Post: 08-20-2004, 03:20 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21