Hello ,
Does below program have a C++ style??
////==================Strart================================////
#include <ansi_c.h>
#include <cvirte.h>
typedef struct A{
int (* add)(int a,int b);
int (* sub)(int a,int b);
void (* output)(char *);
} STA;
int add(int a, int b)
{
return a+b;
}
int sub(int a, int b)
{
return a-b;
}
void output(char *str)
{
printf("%s",str);
}
int __stdcall WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpszCmdLine, int nCmdShow)
{
STA sta;
if (InitCVIRTE (hInstance, 0, 0) == 0)
return -1; /* out of memory */
sta.add =add;
sta.sub =sub;
sta.output=output;
printf("2+1 = %d\n",(*sta.add)(2,1));
(*sta.output)("hello,world!\n");
getchar();
return 0;
}
////==================End================================////