[問題] 一直算出0
剛剛寫了一個算電話費率的程式
還沒寫完
想說先測試一種情況
但是他一直算出0= =
能請高手們幫我看一下問題出在哪嗎??
感激
#include <iostream>
using namespace std;
double hour,min,min_1,cost;
const double RATE=0.40;
char day_1,day_2,M,m;
int main()
{
cout<<"This program is to calculate the cost of your call."<<endl;
cout<<"Here are the rules of the cost:"<<endl;
cout<<"Any call started between 8:00am and 6:00pm,Mon to Fri,is cost 0.4$per min."<<endl;
cout<<"Any call started before 8:00am and after 6:00pm,Mon to Fri,is cost 0.25$"<<endl
<<"per min."<<endl;
cout<<"Any call started on Sat and Sun,is cost 0.15$per min."<<"\n\n\n\n";
cout<<"Enter the first and second letter of the day(like Monday=Mo): ";
cin>>day_1>>day_2;
cout<<"Enter the time the call started(in 24-hour notation)."<<endl;
cout<<"hour: ";
cin>>hour;
cout<<"min: ";
cin>>min;
cout<<"Enter the length of the call in min: ";
cin>>min_1;
while((day_1==M)||(day_1==m))
{
if((8<=hour+(min+min_1)/60.0)&&(hour+(min+min_1)/60.0<=18))
cost=min_1*RATE;
}
cout<<"The cost is: "<<cost;
return 0;
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.113.63.2
→
10/25 18:51, , 1F
10/25 18:51, 1F
→
10/25 18:56, , 2F
10/25 18:56, 2F
※ 編輯: ManInBlackXD 來自: 140.113.63.2 (10/25 19:00)
→
10/25 19:03, , 3F
10/25 19:03, 3F
→
10/25 19:08, , 4F
10/25 19:08, 4F
→
10/25 19:09, , 5F
10/25 19:09, 5F
→
10/25 19:10, , 6F
10/25 19:10, 6F
→
10/25 19:26, , 7F
10/25 19:26, 7F
推
10/25 19:29, , 8F
10/25 19:29, 8F
→
10/25 19:30, , 9F
10/25 19:30, 9F
→
10/25 20:45, , 10F
10/25 20:45, 10F
推
10/25 23:13, , 11F
10/25 23:13, 11F
→
10/25 23:13, , 12F
10/25 23:13, 12F
→
10/25 23:13, , 13F
10/25 23:13, 13F
→
10/25 23:15, , 14F
10/25 23:15, 14F
→
10/25 23:16, , 15F
10/25 23:16, 15F
→
10/25 23:16, , 16F
10/25 23:16, 16F
推
10/25 23:45, , 17F
10/25 23:45, 17F
→
10/25 23:46, , 18F
10/25 23:46, 18F
推
10/25 23:48, , 19F
10/25 23:48, 19F
→
10/25 23:48, , 20F
10/25 23:48, 20F
→
10/26 00:18, , 21F
10/26 00:18, 21F
→
10/26 00:57, , 22F
10/26 00:57, 22F
→
10/26 02:10, , 23F
10/26 02:10, 23F