Как преобразовать эту программу C++ в программу C?
#include <iostream> #include <stdlib.h> #include <iomanip> #include <conio.h> #include <windows.h> using namespace std; void textcolor(int color); struct payroll { string name; float rate_per_day,sss,philhealth; int total_days_work; }; float compute_gross(float rate_per_day, float days_worked) { return(rate_per_day * days_worked); } float compute_net(float rate_per_day, float days_worked, float sss,float philhealth) { float gross_pay=0.00, deductions=0.00, net_income=0.00; gross_pay = (rate_per_day * days_worked); deductions = (sss+philhealth); net_income = (gross_pay - deductions); return(net_income); } float compute_deductions(float sss,float philhealth) { return(sss+philhealth); }
основной метод.
main() { payroll employee; cout << "\t Simple Payroll System "; cout << "\n\n"; cout << " Enter Employees Name : "; getline(cin,employee.name); cout << " Enter Employees Rate/Day : "; cin >> employee.rate_per_day; cout << " Enter Number of Days Worked : "; cin >> employee.total_days_work; cout << "\n\n"; cout << " == DEDUCTIONS == "; cout << "\n\n"; cout << "\nSSS Contribution : "; cin >> employee.sss; cout << "PhilHealth Contribution : "; cin >> employee.philhealth; cout << "\n\n"; cout << fixed << setprecision(2); cout << " Total Deductions => Php " << compute_deductions(employee.sss, employee.philhealth); cout << "\n"; cout << " Monthly Gross Income : Php " << compute_gross(employee.rate_per_day, employee.total_days_work); cout << "\n\n"; cout << "\n Employees Name : " << employee.name; cout << "\n Monthly Net Income : Php " << compute_net(employee.rate_per_day, employee.total_days_work, employee.sss,employee.philhealth); cout << "\n\n"; system("pause"); }
Что я уже пробовал:
&lI пробовали разные способы, но я сейчас борюсь.