Skip to content

Instantly share code, notes, and snippets.

@kdmkdmkdm
Created May 1, 2012 19:18
Show Gist options
  • Select an option

  • Save kdmkdmkdm/2570648 to your computer and use it in GitHub Desktop.

Select an option

Save kdmkdmkdm/2570648 to your computer and use it in GitHub Desktop.
calculatorInProgress
// giCaluclatorProgram.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int choice = 0;
cout << "1) cos(x), 2) sin(x), 3) tan(x), 4) atan2(y, x), 5) sqrt(x), 6) x^y" << endl;
cout << "7) ln(x), 8) e^x, 9) |x|, 10) floor(x), 11) ceil(x), 12) Exit.";
cin >> choice;
switch(choice)
{
case 1:
{
float x = 0;
cout << "Enter x: ";
cin >> x;
cout << "cos(x) = " << cosf(x);
}
case 2:
{
float x = 0;
cout << "Enter x: ";
cin >> x;
cout << "sin(x) = " << sinf(x);
}
case 3:
{
float x = 0;
cout << "Enter x: ";
cin >> x;
cout << "tan(x) = " << tanf(x);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment