|
-
Oct 27th, 2000, 07:25 PM
#1
Does anyone have a sample calculator program i could look at?
-
Oct 29th, 2000, 11:06 AM
#2
Lively Member
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 
-
Oct 30th, 2000, 10:51 AM
#3
Member
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]
-
Nov 1st, 2000, 07:36 PM
#4
Not very good, but I have a DOS based Calculator. E-mail me if you would like it.
-
Nov 2nd, 2000, 08:31 AM
#5
Member
I used a sample from the MSDN:
VB-KnowledgeBase, Example to Evaluate
Basic Numeric Expressions
Article ID: Q86688
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|