Results 1 to 5 of 5

Thread: Calculator programs

  1. #1
    Guest

    Post

    Does anyone have a sample calculator program i could look at?

  2. #2
    Lively Member
    Join Date
    Sep 2000
    Location
    Singapore
    Posts
    78
    I did a calculator program using MFC too just that it only supports the 4 operations and can perform on 2 numbers only.

    If you want, I can email to you the program

  3. #3
    Member
    Join Date
    Oct 2000
    Posts
    39

    Post Simple Calculator

    This is a very simple and basic calculator I wrote in C for a homework assignment a while ago.

    Maybee this helps.
    Code:
    
    #include <stdio.h>
    #include <conio.h>
    
    void main(void)
    	{
    	float num1=1.0, num2=1.0;
    	char op;
    
    	while(!(num1==0.0 && num2==0.0) )
    		{
    		printf("\n\nEnter in Number, operator, and number: ");
    		scanf("%f %c %f", &num1, &op, &num2);
    		switch(op)
    			{
    			case '+':
    				printf(" = %f", num1 + num2);
    				break;
    			case '-':
    				printf(" = %f", num1 - num2);
    				break;
    			case '*':
    				printf(" = %f", num1 * num2);
    				break;
    			case '/':
    				printf(" = %f", num1 / num2);
    				break;
    			default:
    				printf("Unknown operator");
    			}
    		}
    	}
    P.S
    Can someone also tell me how to make this tabbed and indented properly.
    Thank you


    [Edited by silicon valley on 11-09-2000 at 06:28 PM]

  4. #4
    Guest
    Not very good, but I have a DOS based Calculator. E-mail me if you would like it.

  5. #5
    Member
    Join Date
    Oct 2000
    Posts
    35
    I used a sample from the MSDN:

    VB-KnowledgeBase, Example to Evaluate
    Basic Numeric Expressions
    Article ID: Q86688
    rfo

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width