標題:
電費計算機 (一)
[打印本頁]
作者:
周政輝
時間:
2018-5-26 14:59
標題:
電費計算機 (一)
參考台灣電力公司所公怖的電費計算表格, 設計一個計算電費的小工具,
讓使用者輸入月份, 與該月份的用電度數, 電腦回應該月份的電費.
[attach]4157[/attach]
作者:
鄭楀諺
時間:
2018-5-26 15:25
#include <cstdlib>
#include <iostream>
using namespace std;
int main()
{
int month=0,power=0;
cout<<"請輸入月份:";
cin>>month;
cout<<endl;
cout<<"請輸入電度數";
cin>>power;
if(month>=10||month<=5)
{
if(power<=120)
{
cout<<month<<"月份的電費為2.1元"<<endl;
}
if(power>=121&&power<=330)
{
cout<<month<<"月份的電費為2.68元"<<endl;
}
if(power>=331&&power<=500)
{
cout<<month<<"月份的電費為3.61元"<<endl;
}
if(power>=501&&power<=700)
{
cout<<month<<"月份的電費為4.48元"<<endl;
}
if(power>=701&&power<=1000)
{
cout<<month<<"月份的電費為5.03元"<<endl;
}
if(power>=1001)
{
cout<<month<<"月份的電費為5.28元"<<endl;
}
}
else if(month>=6||month<=9)
{
if(power<=120)
{
cout<<month<<"月份的電費為2.1元"<<endl;
}
if(power>=121&&power<=330)
{
cout<<month<<"月份的電費為3.02元"<<endl;
}
if(power>=331&&power<=500)
{
cout<<month<<"月份的電費為4.39元"<<endl;
}
if(power>=501&&power<=700)
{
cout<<month<<"月份的電費為5.44元"<<endl;
}
if(power>=701&&power<=1000)
{
cout<<month<<"月份的電費為6.16元"<<endl;
}
if(power>=1001)
{
cout<<month<<"月份的電費為6.71元"<<endl;
}
}
system("pause");
return 0;
}
複製代碼
作者:
林峻安
時間:
2018-5-26 15:30
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int math=0;
int ww=0;
cout<<"月份:"<<endl;
cin>>math;
cout<<"用電量";
cin>>ww;
if(6<math||9<math)
{
else if(ww<120)
{
cout<<"2.1元"<<endl;
}
else if(121<=ww||ww<=330)
{
cout<<"2.68元"<<endl;
}
else if(331<=ww||ww<=500)
{
cout<<"3.61元"<<endl;
}
else if(501<=ww||ww<=700)
{
cout<<"4.48元"<<endl;
}
else if(701<=ww||ww<=1000)
{
cout<<"5.03元"<<endl;
}
else if(ww<1001)
{
cout<<"5.28元"<<endl;
}
}
system("pause");
return 0;
}
複製代碼
作者:
戴嘉禾
時間:
2018-5-26 15:30
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int month=0;
int num=0;
cout<<"月份:";
cin>>month;
cout<<"度數:";
cin>>num;
if(month= 5 || 6 || 7 || 8 || 9 || 10 )
{
if(num<=120)
{
cout<<"2.1"<<endl;
}
else if(num>=121&&<=330)
{
cout<<"2.68"<<endl;
}
else if(num>=331&&<=500)
{
cout<<"3.61"<<endl;
}
else if(num>=501&&<=700)
{
cout<<"4.48"<<endl;
}
else if(num>=701&&<=1000)
{
cout<<"5.03"<<endl;
}
else if(num>=1001)
{
cout<<"5.28"<<endl;
}
if(month= 11 || 12 || 1 || 2 || 3 || 4 )
{
if(num<=120)
{
cout<<"2.1"<<endl;
}
else if(num>=121&&<=330)
{
cout<<"3.02"<<endl;
}
else if(num>=331&&<=500)
{
cout<<"4.39"<<endl;
}
else if(num>=501&&<=700)
{
cout<<"5.44"<<endl;
}
else if(num>=701&&<=1000)
{
cout<<"6.16"<<endl;
}
else if(num>=1001)
{
cout<<"6.71"<<endl;
}
}
system("pause") ;
return 0;
}
複製代碼
作者:
吳秉翰
時間:
2018-5-26 15:32
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int season=0;
int degree=0;
cout<<"是否為夏季(1)是(2)否"<<endl;
cin>>season;
if(season==1)
{
cin>>degree;
if(degree<121)
{
cout<<"2.1元"<<endl;
}
if(degree>120&°ree<331)
{
cout<<"3.02元"<<endl;
}
if(degree>330&&<501)
{
cout<<"4.39元"<<endl;
}
if(degree>500&&<701)
{
cout<<"5.44元"<<endl;
}
if(degree>700&&<1001)
{
cout<<"6.16元"<<endl;
}
if(degree>1000)
{
cout<<"6.71元"<<endl;
}
}
if(season==2)
{
cin>>degree;
if(degree<121)
{
cout<<"2.1元"<<endl;
}
if(degree>120&°ree<331)
{
cout<<"2.68元"<<endl;
}
if(degree>330&&<501)
{
cout<<"3.61元"<<endl;
}
if(degree>500&&<701)
{
cout<<"4.48元"<<endl;
}
if(degree>700&&<1001)
{
cout<<"5.03元"<<endl;
}
if(degree>1000)
{
cout<<"5.28元"<<endl;
}
}
system("pause");
return 0;
}
複製代碼
作者:
王駿愷
時間:
2018-5-30 20:20
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int power=0;
int month=0;
cout<<"請輸入本期月份";
cin>>power;
cout<<endl;
cout<<"請輸入本月用電量";
cin>>power;
cout<<endl;
if(month<=5||month>=10)
{
if(power<=120)
{
cout<<"本月用電量每度2.1元"<<endl;
}
if(power>=121&&power<=330)
{
cout<<"本月用電量每度2.68元"<<endl;
}
if(power>=331&&power<=500)
{
cout<<"本月用電量每度3.61元"<<endl;
}
if(power>=501&&power<=700)
{
cout<<"本月用電量每度4.48元"<<endl;
}
if(power>=701&&power<=1000)
{
cout<<"本月用電量每度5.03元"<<endl;
}
if(power>=1001)
{
cout<<"本月用電量每度5.28元"<<endl;
}
}
else if(month>=6||month<=9)
{
if(power<=120)
{
cout<<"本月用電量每度2.1元"<<endl;
}
if(power>=121&&power<=330)
{
cout<<"本月用電量每度3.02元"<<endl;
}
if(power>=331&&power<=500)
{
cout<<"本月用電量每度4.39元"<<endl;
}
if(power>=501&&power<=700)
{
cout<<"本月用電量每度5.44元"<<endl;
}
if(power>=701&&power<=1000)
{
cout<<"本月用電量每度6.16元"<<endl;
}
if(power>=1001)
{
cout<<"本月用電量每度6.71元"<<endl;
}
}
system("pause");
return 0;
}
複製代碼
作者:
林峻安
時間:
2018-6-2 11:45
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int math=0;
int ww=0;
cout<<"請輸入本期月份:"<<endl;
cin>>math;
cout<<"請輸入本月用電量:"<<endl;
cin>>ww;
if(math<=5||math>=10)
{
if(ww<=120)
{
cout<<"本月用電量每度2.1元"<<endl;
}
if(ww>=121&&ww<=330)
{
cout<<"本月用電量每度2.68元"<<endl;
}
if(ww>=331&&ww<=500)
{
cout<<"本月用電量每度3.61元"<<endl;
}
if(ww>=501&&ww<=700)
{
cout<<"本月用電量每度4.48元"<<endl;
}
if(ww>=701&&ww<=1000)
{
cout<<"本月用電量每度5.03元"<<endl;
}
if(ww>=1001)
{
cout<<"本月用電量每度5.28元"<<endl;
}
}
else if(math>=6||math<=9)
{
if(ww<=120)
{
cout<<"本月用電量每度2.1元"<<endl;
}
if(ww>=121&&ww<=330)
{
cout<<"本月用電量每度3.02元"<<endl;
}
if(ww>=331&&ww<=500)
{
cout<<"本月用電量每度4.39元"<<endl;
}
if(ww>=501&&ww<=700)
{
cout<<"本月用電量每度5.44元"<<endl;
}
if(ww>=701&&ww<=1000)
{
cout<<"本月用電量每度6.16元"<<endl;
}
if(ww>=1001)
{
cout<<"本月用電量每度6.71元"<<endl;
}
}
system("pause");
return 0;
}
複製代碼
作者:
顏詢
時間:
2018-6-2 13:08
#include <cstdlib>
#include <iostream>
using namespace std;
int main()
{
int month=0,power=0;
cout<<"請輸入月份:";
cin>>month;
cout<<endl;
cout<<"請輸入電度數";
cin>>power;
if(month>=10||month<=5)
{
if(power<=120)
{
cout<<month<<"月份的電費為2.1元"<<endl;
}
if(power>=121&&power<=330)
{
cout<<month<<"月份的電費為2.68元"<<endl;
}
if(power>=331&&power<=500)
{
cout<<month<<"月份的電費為3.61元"<<endl;
}
if(power>=501&&power<=700)
{
cout<<month<<"月份的電費為4.48元"<<endl;
}
if(power>=701&&power<=1000)
{
cout<<month<<"月份的電費為5.03元"<<endl;
}
if(power>=1001)
{
cout<<month<<"月份的電費為5.28元"<<endl;
}
}
else if(month>=6||month<=9)
{
if(power<=120)
{
cout<<month<<"月份的電費為2.1元"<<endl;
}
if(power>=121&&power<=330)
{
cout<<month<<"月份的電費為3.02元"<<endl;
}
if(power>=331&&power<=500)
{
cout<<month<<"月份的電費為4.39元"<<endl;
}
if(power>=501&&power<=700)
{
cout<<month<<"月份的電費為5.44元"<<endl;
}
if(power>=701&&power<=1000)
{
cout<<month<<"月份的電費為6.16元"<<endl;
}
if(power>=1001)
{
cout<<month<<"月份的電費為6.71元"<<endl;
}
}
system("pause");
return 0;
}
複製代碼
作者:
黃安立
時間:
2018-6-2 13:38
#include <cstdlib>
#include <iostream>
using namespace std;
int main()
{
int month=0,power=0;
cout<<"請輸入月份:";
cin>>month;
cout<<endl;
cout<<"請輸入電度數";
cin>>power;
if(month>=10||month<=5)
{
if(power<=120)
{
cout<<month<<"月份的電費為2.1元"<<endl;
}
if(power>=121&&power<=330)
{
cout<<month<<"月份的電費為2.68元"<<endl;
}
if(power>=331&&power<=500)
{
cout<<month<<"月份的電費為3.61元"<<endl;
}
if(power>=501&&power<=700)
{
cout<<month<<"月份的電費為4.48元"<<endl;
}
if(power>=701&&power<=1000)
{
cout<<month<<"月份的電費為5.03元"<<endl;
}
if(power>=1001)
{
cout<<month<<"月份的電費為5.28元"<<endl;
}
}
else if(month>=6||month<=9)
{
if(power<=120)
{
cout<<month<<"月份的電費為2.1元"<<endl;
}
if(power>=121&&power<=330)
{
cout<<month<<"月份的電費為3.02元"<<endl;
}
if(power>=331&&power<=500)
{
cout<<month<<"月份的電費為4.39元"<<endl;
}
if(power>=501&&power<=700)
{
cout<<month<<"月份的電費為5.44元"<<endl;
}
if(power>=701&&power<=1000)
{
cout<<month<<"月份的電費為6.16元"<<endl;
}
if(power>=1001)
{
cout<<month<<"月份的電費為6.71元"<<endl;
}
}
system("pause");
return 0;
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://istak.org.tw/seed/)
Powered by Discuz! 7.2