//mathlib.h
#ifndef _MYMATH_H
#define _MYMATH_H
extern "C" int Summary(int n);
extern "C" int Factorial(int n);
#endif
//mathlib.cpp
#include "stdafx.h"
#include "mathlib.h"
int Summary(int n)
{
int sum=0;
int i;
for(i=1;i<=n;i++)
{
sum+=i;
}
return sum;
}
int Factorial(int n)
{
int Fact=1;
int i;
for(i=1;i<=n;i++)
{
Fact=Fact*i;
}
return Fact;
}
#include "stdafx.h"
#include<iostream>
#include "mathlib.h"
#pragma comment(lib,"StaticLib.lib")
int _tmain(int argc, _TCHAR* argv[])
{
int nSum=Summary(10);
std::cout<<"Sum(10)="<<nSum<<std::endl;
int nFact=Factorial(10);
std::cout<<"10!="<<nFact<<std::endl;
return 0;
}