2013-10-25 4 views
2

본질적으로 짧은 스크립트를 작성하고 있습니다. 살펴 보는 가장 쉬운 방법은 리소스 컬렉션이있는 게임을위한 것입니다. ResGain은 얻은 리소스이며, BonusGain은 추가 리소스를 얻을 수있는 기회입니다. ResGain 및 Bonus Gain 함수에 대한 식별자를 찾을 수 없습니다. 그러나 ResGain 및 BonusGain 함수는 main 앞에 선언했습니다. 어떤 아이디어?오류 C3861 : 'ResGain': 식별자를 찾을 수 없습니다.

#include <iostream> 
#include <cstdlib> 
#include <stdio.h> 
#include <stdlib.h> 

using namespace std; 


float ResGain(float u, int r) //calc Base resource Gain 
    { 
     float lapout; 

     lapout = r * u; 

     return (lapout); 
    } 

char BonusGain(int b) //Determines if a bonus material would be produced. 
{ 
    char bonus; 
    int rng; 

    rng = rand() % 100 + 1; 

    if (rng <= b) 
     bonus = 1; 
    return(bonus); 
} 


int main() 
{ 
    float l; 

    l = ResGain(1.1,70); 

    cout << "You have earned" << l << "Lapis"; 
    if (BonusGain(3)==1) 
     cout << "You have also earned a bonus material"; 
    system("pause"); 
    return 0; 
} 

답변

0

대부분의 아마 찾을 수 없습니다 식별자는 표준 라이브러리의 일부가 아닌 system()이다. 선언 된 Windows 관련 헤더를 찾아야합니다.

관련 문제