Nice I also just started learning c++
Like yesterday and today were my first lectures, something I whipped up:
C++ Code:
#include <iostream>
#include <windows.h>
using namespace std;
void Add()
{
double a, b, c;
cout << "Enter the first number" << endl;
cin >> a;
cout << "Enter the second number" << endl;
cin >> b;
c = a + b;
cout << a;
cout << " + ";
cout << b;
cout << " is equal to: ";
cout << c << endl;
Sleep(5000);
}
void Subtract()
{
double a, b, c;
cout << "Enter the first number" << endl;
cin >> a;
cout << "Enter the second number" << endl;
cin >> b;
c = a - b;
cout << a;
cout << " - ";
cout << b;
cout << " is equal to: ";
cout << c << endl;
Sleep(5000);
}
void Multiply()
{
double a, b, c;
cout << "Enter the first number" << endl;
cin >> a;
cout << "Enter the second number" << endl;
cin >> b;
c = a * b;
cout << a;
cout << " * ";
cout << b;
cout << " is equal to: ";
cout << c << endl;
Sleep(5000);
}
void Divide()
{
double a, b, c;
cout << "Enter the first number" << endl;
cin >> a;
cout << "Enter the second number" << endl;
cin >> b;
c = a / b;
cout << a;
cout << " / ";
cout << b;
cout << " is equal to: ";
cout << c << endl;
Sleep(5000);
}
int main()
{
int input;
cout << "What operation to perform (Add(1), Subtract(2), Multiply(3), Divide(4))" << endl;
cin >> input;
switch ( input ) {
case 1:
Add();
break;
case 2:
Subtract();
break;
case 3:
Multiply();
break;
case 4:
Divide();
break;
default:
cout << "Error, bad input, quitting\n";
break;
}
}
Edit: I see you Brandon, any pointers?