using namespace std;
void bill(int kind,int message_total);
void main ()
{
cout<<"(1)10元包150條短信,超出部分按0.1元1條計算;"<<endl;
cout<<"(2)20元包300條短信,超出部分按0.1元1條計算;"<<endl;
cout<<"(3)30元包600條短信,超出部分按0.1元1條計算。"<<endl;
cout<<endl;
cout<<"請輸入妳所要選擇的套餐:";
int kind;
cin>>kind;
cout<<"請輸入該月妳所發的短信個數:";
int message_total;
cin>>message_total;
bill(kind,message_total);
cout<<endl;
}
void bill(int kind,int message_total)
{
if(kind==1)
cout<<"妳的費用為: "<<10+(message_total-150)*0.1<<endl;
else if(kind==2)
cout<<"妳的費用為: "<<20+(message_total-300)*0.1<<endl;
else
cout<<"妳的費用為: "<<30+(message_total-600)*0.1<<endl;
}
望采納謝謝