2016-09-22 2 views
-4

인플레이션 율 계산기를 구축하려하지만 작동하지 않습니다. 저는 현재 학교에 다니지 않고 학교의 PC를 사용하여 모든 오류가 한국어로 표시됩니다. 번역은했지만 아주 이해하지 못했습니다.인플레이션 율 계산기 C++

#include <iostream> 
using namespace std; 

double inflationRate (double startingPrice, double currentPrice); 

int main() 
{ 
    double startingPrice, currentPrice; 
    char again; 

    do 
    { 
     cout << "enter the price of the item when you bought it: "; 
     cin >> startingPrice; 

     cout << "enter the price of the item today: "; 
     cin >> currentPrice; 

     cout << "the inflation Rate is: " << inflationRate(startingPrice, currentPrice) << "%"; 

     cout << "would you like to try another item (y/n)?"; 
     cin >> again; 

    }while((again == 'Y') || (again =='y')); 

    return 0; 
} 

double inflationRate(double startingPrice, double currentPrice) 
{ 
    return ((currentPrice - startingPrice)/startingPrice); 
} 

1> ------ 빌드 시작 : 프로젝트 : 테스트, 구성 : 디버그는 Win32 ------

1> 빌드 시작 : 2016년 9월 22일 11시 4분 : 39 AM

1> InitializeBuildStatus :

1> "디버그 \의 testing.unsuccessfulbuild"연결 (접촉)을.

1> ClCompile :

1> 모든 출력이 최신입니다.

1> ManifestResourceCompile :

1> 모든 출력은 최신 버전입니다.

1> LINK : 치명적인 오류 LNK1123 : COFF로 변환하는 동안 오류가 발생했습니다. 또는 손상된 파일이 잘못되었습니다.

1>

1> 빌드 실패.

1>

1> 경과 시간 : 00 : 00 : 00.08

========== 빌드 : 0, 1 실패, 성공 최신 0, 0이 생략 ==

+1

당신이 이름을'inflationRate'있는 기능과 변수를 모두 가지고 중 하나를 변경 :이 당신이 (필자는 첫 번째 줄에 #을되었다 복사 - 붙여 넣기 오류가 있으리라 믿고있어) 원하는 것을 생각 그들 – vu1p3n0x

+0

translate.google을 사용하고 그 오류를 보여 주려고 할 수 있습니다 – YakovL

답변

0

inflationRate 함수를 호출하는 대신 쓸모없는 변수 inflationRate을 선언하고 있습니다.

#include <iostream> 
using namespace std; 


double inflationRate (double startingPrice, double currentPrice); // <-- Missing semicolon! 


int main() // <-- Not void; use int. 
{ 
double startingPrice, currentPrice; // <-- Removed inflationRate variable. 
char again; 

do 
{ 
    cout << "enter the price of the item when you bought it: "; 
    cin >> startingPrice; 

    cout << "enter the price of the item today: "; 
    cin >> currentPrice; 

    cout << "the inflation Rate is: " << inflationRate(startingPrice, currentPrice) << "%"; // <-- Calling inflationRate 

    cout << "would you like to try another item (y/n)?"; 
    cin >> again; 

}while((again == 'Y') || (again =='y')); 

return 0; 

} 

double inflationRate(double startingPrice, double currentPrice) 
{ 
    return ((currentPrice - startingPrice)/startingPrice); 
} 
+0

감사합니다! 이제 작동합니다. – Fernanda