i did this test program and compiled it...but why da hell do it make an exe with about 500kb!??!
PHP Code:// test1.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
using namespace std;
class Maths
{
public:
static void Maths::Intro()
{
cout << "You can execute up to 4 mathematical operations:\n";
cout << "\tAdd\t\t1\n";
cout << "\tSubtract\t2\n";
cout << "\tMulitply\t3\n";
cout << "\tDivide\t\t4\n\n";
cout << "Which one you want to perform?\n(Type the number of the operation)\n";
}
static int Maths::Add(int num1, int num2)
{
return num1 + num2;
}
static int Maths::Subtract(int num1, int num2)
{
return num1 - num2;
}
static int Maths::Multiply(int num1, int num2)
{
return num1 * num2;
}
static int Maths::Divide(int num1, int num2)
{
return num1 / num2;
}
};
int _tmain(int argc, _TCHAR* argv[])
{
int res, num1, num2;
Maths::Intro();
cin >> res;
cout << "Now put the first number: ";
cin >> num1;
cout << "\nNow put the second number: ";
cin >> num2;
switch (res)
{
case 1:
cout << num1 << " + " << num2 << " = " << Maths::Add(num1, num2);
break;
case 2:
cout << num1 << " - " << num2 << " = " << Maths::Subtract(num1, num2);
break;
case 3:
cout << num1 << " * " << num2 << " = " << Maths::Multiply(num1, num2);
break;
case 4:
cout << num1 << " / " << num2 << " = " << Maths::Divide(num1, num2);
break;
default:
cout << "It wasn't possible to perform the desired operation";
}
cin >> res;
return 0;
}




Reply With Quote