이 코드가 왜 안되는지 모르겠어요.


분명 if statement는 이리 쓰는걸로 인터넷에서 배웠거든요.


근데 제꺼에선 그냥 쿨 무시하고 다음꺼로 가네요...


1 int main() {

2

3 int retailPrice, salesTax, totalPrice, test;

4

5 cout << "Welcome to retail calculator!" << endl;

6 cout << endl;

7 cout << "What is the retail price?" << endl;

8 cin >> retailPrice;   //price of the item.

9

10   if( retailPrice < 0 ) {

11   cout << "the price cannot be negative!" << endl;

12   cin >> test;

13            test = retailPrice;

14   }

15   else

16

17 cout << "What is the sales tax?" << endl;

18 cin >> salesTax;   //current sales tax.


이건데요.

플그렘을 실행시키면 10번 줄을 빼놓고 바로 17번으로 가더라구요.

10번 라인에서 retailPrice == 0 도 넣어보고 했는데 안되네요...

뭐가 문제 인건가요???