# Sum this up | Very simple calculator

A simple calculator I made that seems to be working quite well.

## Updated: 14th May 2020

``````#include <iostream>

using namespace std;

void calculator();
void credits();

main()
{

calculator();
credits();
return 0;
}

void calculator(){

char calc;
float num1, num2;

std::cout << ("Enter your calculation symbol, +, -, *, or / \n");
cin >> calc;

std::cout << ("Enter first number:\n");

cin >> num1;

std::cout << ("Enter second number:\n");

cin >> num2;

std::cout << ("Your sum ") << num1 << " " << calc << " " << num2 << " " << ("= " );
switch (calc) {

case '+':
cout << num1 + num2;
break;

case '-':
cout << num1 - num2;
break;

case '*':
cout << num1 * num2;
break;

case '/':
cout << num1 / num2;
break;

default:
cout << "Can not complete sum - Please follow on screen instructions";
break;
}
}

void credits(){

puts("\n\n\nThank you for choosing to test this product. This was made as part of the learning process of C and C++.\nWhy not check out more of my small projects on my blog:\nwww.stephenwilde.net");

}
``````

## Previous code:

``````#include <iostream>
using namespace std;

main()
{
char calc;
float num1, num2;

std::cout << ("What would you like to do, +, -, *, or / \n");
cin >> calc;

std::cout << ("Enter first number:\n");

cin >> num1;

std::cout << ("Enter second number:\n");

cin >> num2;

std::cout << ("Your sum ") << num1 << calc << num2 << ("=" );
switch (calc) {

case '+':
cout << num1 + num2;
break;

case '-':
cout << num1 - num2;
break;

case '*':
cout << num1 * num2;
break;

case '/':
cout << num1 / num2;
break;

default:
cout << "Can not complete sum - Please follow on screen instructions";
break;
}

return 0;
} ``````