運行失敗,求大神指點。
include <stdio.h>
int main()
{
? ? int d,j,t;
? ? float pay(int j,int t)
? ? {
? ? if(j<0||t>24||t<0)
? ? {
? ? ? ? printf("%s\n","輸入錯誤");
? ? ? ? return 0;
? ? }
? ? else if (j<=3)?
? ? {
? ? ? ? return 14;
? ? }
? ? else if (t>=23||t<5)
? ? {
? ? ? ? float d=14+j*2.3*(1+0.2);
? ? ? ? return d;
? ? }
? ? else
? ? {
? ? ? ? float d=11+j*2.3;
? ? ? ? return d;
? ? }
? ? }
? ? float d1=pay(j,t);
? ? {
? ? ? ? int j=12;
? ? ? ? int t=9;
? ? ? ? return d1;
? ? }
? ? float d2=pay(j,t);
? ? {
? ? ? ? int j=12;
? ? ? ? int t=18;
? ? ? ? return d2;
? ? }
? ? printf("總費用%f元\n",d1+d2);
? ? return 0;
}
2019-03-08
#include <stdio.h>
float pay(int j,int t);
int main()
{
? ? printf("總費用%.2f元\n",pay(12,9)+pay(12,18));
? ? return 0;
}
float pay(int j,int t)
{
? ? ? ?if(j<0||t>24||t<0)
? ? ?{
? ? ? ? printf("%s\n","輸入錯誤");
? ? ? ? return 0;
? ? ?}
? ? else if (j<=3)?
? ? ?{
? ? ? ? return 14;
? ? ?}
? ? else if (t>=23||t<5)
? ? ?{
? ? ? ? float a=14+j*2.3*(1+0.2);
? ? ? ? return a;
? ? ?}
? ? else
? ? ?{
? ? ? ? float b=11+j*2.3;
? ? ? ? return b;
? ? ?}
}
2019-03-08
照你的模子給改了下,感覺你的格式有點混亂。。
2019-03-04
親,是這樣的,我們這邊建議您百度查找,希望回答對您有幫助,可以的話請您一定要給一個五星好評呢!