2016-11-15 11 views
-4

私のコーディングに何か不足があるのか​​、間違っているのか聞いてみたかったですか?私は従業員の給与を計算する機能を果たしていました。コンパイルして実行することはできますが、生成する出力は表示されません。c給与を計算するプログラミング機能

私はこのようなアウト取得しようとしている:11

:1200

はEPF控除のpersentageを入力してください(例:出力の値)

をあなたの給与を入力してくださいあなたのEPF控除は$ 600.00

あなたの報酬総額は$ 1200.00- = $ 1668 $ 132.00 + $ 6000.00です$ 132.00

あなたのボーナス(給料の半分)であります0.00

私のコーディングは、このようなものです:あなたはコメントの下にあなたのメインのすべてを保持している

void BasicSalary(); //Ask user to enter basic salary. 
void EPF(double); //To calculate the amount of employees evident fund (EPF) deduction from basic salary. 
void CalculateBonus(double); //To calculate the amount of bonus. Assume bonus is half of basic salary. 
double DisplayTotalPay(double,double); //To calculate the total pay after EPF deduction and bonus reward. 

double salary,epf,totalepf,totalbonus; 

int main() 
{ 
void BasicSalary(); 
void EPF(double); 

printf("\nYour EPF deduction is $%f ",totalepf); 
printf("\nYour bonus (half of salary) is $%f "); 

void CalculateBonus(double); 
double DisplayTotalPay(double,double); 
} 

void BasicSalary() 
{ 
printf("\nPlease enter your salary: "); 
scanf("%f",&salary);  
} 

void EPF(double) 
{ 
printf("\n\nPlease enter the percentage of EPF deduction: "); 
scanf("%f",epf); 

totalepf= (epf/100) * salary; 
} 

void CalculateBonus(double) 
{ 
totalbonus = salary/2; 
} 
double DisplayTotalPay(double,double) 
{ 
printf("\nYour total pay is $%f - $%f + $%f = $%f ", salary, totalepf, totalbonus, salary-totalepf+totalbonus); 
} 
+0

デバッグヘルプ(「なぜこのコードは動作しませんか?」)には、目的の動作、特定の問題またはエラー、および質問自体に再現するのに必要な最短コードが含まれている必要があります。明確な問題文がない質問は、他の読者にとって有用ではありません。 – Ari0nhh

+0

'main'は何もしません。コメントと関数プロトタイプがありますが、コードはありません。 – user3386109

+0

forgorのコメントを解除するには@ user3386109 – rees

答えて

0

。どのように動作するのでしょうか?
また、関数の引数変数には名前が付けられません。変数はすべてグローバルなので、引数は必要ありません。それらのデータ型宣言を削除する方が良い。
別の点は、スキャン時にDoubleと "%lf"を使用することです。 "%f"は浮動小数点数です。

関連する問題