Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 9th, 2012  |  syntax: None  |  size: 0.39 KB  |  hits: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Creating DLL in VC   (Visual Studio 2008)
  2. _declspec (dllimport) int factorial(int no);
  3.        
  4. #include "stdafx.h"
  5. _declspec (dllexport) int factorial(int no)
  6. {
  7.  
  8.  
  9. return no == 0 ? 1 : no * factorial(no-1);
  10. }
  11.        
  12. #include "ServerHeader.h"
  13.  
  14. #include <iostream.h>
  15.  
  16. void main()
  17. {
  18.  
  19.  
  20. int no,i;
  21.  
  22.  
  23. cout<<"Enter number";
  24.  
  25.  
  26. cin>>no;
  27.  
  28.  
  29. i=factorial(n);  // calling the method
  30.  
  31.  
  32. cout<<endl<<i;   // printing ans
  33.  
  34. }