Этот код при компилировании в VS 2008, выдает 2 ошибки типа - error C2440: '=' : cannot convert from 'int (__cdecl *)(void)' to 'int' В роде все одното типа.
Мне совершенно не понятно почему так происходит. Возможно дело в этом - __cdecl * , но мы такое еще не учили. Прошу помочь мне, разобраться, почему появляется ошибка.
Заранее благодарен.
Код: Выделить всё
#include <iostream>
#include <windows.h>
#include <time.h>
using namespace std ;
int Turn ()
{
srand ((unsigned)time(NULL)) ;
int cubeA , cubeB , cube = 0 ;
cubeA = rand () % 6 + 1 ;
cubeB = rand () % 6 + 1 ;
cout << " cubeA - " << cubeA << endl ;
cout << " cubeB - " << cubeB << endl ;
cube = cubeA + cubeB ;
return cube ;
}
void main ()
{
SetConsoleOutputCP(1251);
int enterNum ;
int user = 0 , comp = 0 ;
int i = 1 ;
cin >> enterNum ;
if (enterNum == 1) {
while (i <= 10)
{
if (i % 2 == 0) {
comp = Turn ;
cout << " comp - " << comp << endl ; }
else {
user = Turn ;
cout << " user - " << user << endl ; }
i ++ ;
}
}
}