[問題] 荷世平老師的作業...
不知道為什麼
一直跑不出來耶
總是有錯誤 又不知道電腦顯示什麼...
什麼叫做沒有給定初始值啊...!?
還有什麼沒有相符的IF...
以下是我的CODE
//price.cpp
//tell customers how much they should pay.
#include <iostream>
#include <iomanip>
using namespace std;
int main ()
{
int price, N;
cout<<"Please enter the number of T-shirts."<<endl;
cin>>N;
if (N<0)
cout<<"Error!! Please check the number you enter again.";
else if (N>=0 && N<3)
price=N*12;
else if (N>=3 && N<10)
price=N*10;
else if (N>=10 && N<=24)
price=N*7;
cout<<"The price is"<<price<<"dollars"<<endl;
else if (N>24)
cout<<"sorry,you can only buy less than 24 T-shirts.";
return 0;
}
好像是倒數第三行有IF的問題吧...
我找不到助教 他也還沒回我信
可是下禮拜要交了...
有人看得出來我錯在哪嗎??!!
在此深深感謝
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 118.165.219.212
推
10/25 13:51, , 1F
10/25 13:51, 1F
→
10/25 14:34, , 2F
10/25 14:34, 2F
推
10/25 14:34, , 3F
10/25 14:34, 3F
→
10/25 14:34, , 4F
10/25 14:34, 4F
推
10/25 14:37, , 5F
10/25 14:37, 5F
推
10/25 16:38, , 6F
10/25 16:38, 6F
推
10/25 17:14, , 7F
10/25 17:14, 7F
→
10/25 18:16, , 8F
10/25 18:16, 8F
→
10/25 18:17, , 9F
10/25 18:17, 9F
推
10/25 21:50, , 10F
10/25 21:50, 10F
→
10/25 21:51, , 11F
10/25 21:51, 11F
→
10/26 09:06, , 12F
10/26 09:06, 12F