Important alert: (current site time 7/16/2013 8:09:01 AM EDT)
 

VB icon

Basic Calculator

Email
Submitted on: 6/22/2011 8:29:17 PM
By: Jake Rodriguez Pomperada  
Level: Advanced
User Rating: Unrated
Compatibility: C
Views: 2300
author picture
(About the author)
 
     A very simple calculator that I wrote using the C language in my free time doing nothing. I hope my work help beginners in C language. If you find my work useful send me an email at jakerpomperada@yahoo.com. Be one of my friend in facebook.com my account address is jakerpomperada@yahoo.com. People here in the Philippines who want to contact me can reach me in my mobile phone number 09993969756 and my landline number (034) 4335081. I am also accepting programming job in C/C++, Java, Visual Basic, MS Access, Visual Foxpro, Clipper, Pascal, PHP/MySQL, BASIC and C# programming languages with very affordable price. Thank you very much and Happy Programming. Regards, Mr. Jake Rodriguez Pomperada, MAED - Instructional Technology Teacher, Systems Analyst, Programmer, Computer Technician and Electronics Technician
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.
				
//**************************************
// Name: Basic Calculator
// Description:A very simple calculator that I wrote using the C language in my free time doing nothing. I hope my work help beginners in C language.
If you find my work useful send me an email at jakerpomperada@yahoo.com. Be one of my friend in facebook.com my account address is jakerpomperada@yahoo.com. People here in the Philippines who want to contact me can reach me in my mobile phone number 09993969756 and my landline number (034) 4335081. 
I am also accepting programming job in C/C++, Java, Visual Basic, MS Access, Visual Foxpro, Clipper, Pascal, PHP/MySQL, BASIC and C# programming languages with very affordable price. Thank you very much and Happy Programming.
Regards,
Mr. Jake Rodriguez Pomperada, MAED - Instructional Technology
Teacher, Systems Analyst, Programmer, Computer Technician and Electronics Technician
// By: Jake Rodriguez Pomperada
//
//This code is copyrighted and has// limited warranties.Please see http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=13576&lngWId=3//for details.//**************************************

#include <stdio.h>
main()
{
char arithOp;/* Arithmetic operator */
float op1;/* First operand*/
float op2;/* Second operand*/
float answer;/* Result*/
/* Enter data */
while ( arithOp != 'Q' )
{
	printf( "Enter a calculation: " );
	scanf( "%f %c %f", &op1, &arithOp, &op2 );
/* Perform calculations */
	switch ( arithOp )
	{
	case '-': /* Subtraction */
		op2 = -op2;
		case '+': /* Addition */
		answer = op1 + op2;
		printf( " = %.1f\n", answer );
		break;
	case '*': /* Multiplication */
		answer = op1 * op2;
		printf( " = %.1f\n", answer );
		break;
	case '/': /* Division */
		answer = op1 / op2;
		printf( " = %.1f\n", answer );
		break;
	case 'Q':
		break;
	default:/* Bad operator */
		printf("Illegal operator ");
		break;
	}
}
}


Other 232 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Advanced category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.