D:Josh RiveraAdv Comp Scipayroll (program 1).cpp(90) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
D:Josh RiveraAdv Comp Scipayroll (program 1).cpp(92) : warning C4305: '=' : truncation from 'const double' to 'float'
D:Josh RiveraAdv Comp Scipayroll (program 1).cpp(93) : warning C4305: '=' : truncation from 'const double' to 'float'
D:Josh RiveraAdv Comp Scipayroll (program 1).cpp(94) : warning C4305: '=' : truncation from 'const double' to 'float'
D:Josh RiveraAdv Comp Scipayroll (program 1).cpp(95) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
i am so lost, all those warnings, and i dont get it cause all the vaiables are floats. here is the code:
#include <iostream.h> #include <math.h> #include <stdlib.h> #include <fstream.h> #include <iomanip.h> #include <string.h> #include <ctype.h> void open_infile(); void open_outfile(); void close_infile(); void close_outfile(); void do_again(); void title(); void input(); void calculate(); void check_out1(); void check_out2(); void end(); int i,j,k; float state,fed,regularpay,stated,fedd,totald,netpay,regularpayrate; float grosspay,overtimepay,checknum,hours,overtime,overtimehours,totalhours; char name[15],y_n[4],security[11]; setw();//enables setw ofstream outfile; ifstream infile;//enables outfile & infilevoid main() { title(); }
void title() { cout << "C++ Organizer: Josh Rivera 'aka' sloth "; cout << "Class: Computer Science, RRHS ";//introduces program cout << "Instructor: Mr H, Block 2 "; cout << "Program #1: Payroll "; i=1; do_again(); } void do_again() { cout << " Would you like to use the payroll system? ";//prompts user cout << "Enter Yes or No and press enter to continue "; cin >> y_n; system("cls"); if(((strcmp(y_n,"yes")==0)||(strcmp(y_n,"Yes")==0))) { cout << "Thank You for playing "; input();
} else if(((strcmp(y_n,"no")==0)||(strcmp(y_n,"No")==0)||(strcmp(y_n,"NO")==0))) { system("cls"); end(); } else { cout << "Please read and follow all directions ";//if directions aren't followed do_again(); } }//end function
void input() { cout << "Please enter you name."; cin >> name; cout << "Please enter your social security number."; cin >> security;
calculate();
}
void calculate() { if(((strcmp(name,"sloth")==0)||(strcmp(name,"Sloth")==0))) { cout << "Enter the number of hours that you worked"; cin >> totalhours; if (totalhours>40.00) { overtimehours=totalhours-40.00; hours=40.00; state=0.060; fed=0.220; regularpayrate=5.55; overtime=regularpayrate*1.50; overtimepay=overtime*overtimehours; regularpay=regularpayrate*hours; grosspay=regularpay+overtimepay; fedd=grosspay*fed; stated=grosspay*state; totald=stated+fedd; netpay=grosspay-totald;
check_out1(); } else if ((totalhours<=40)&&(totalhours>0)) { overtimehours=0; hours=totalhours; state=0.060; fed=0.220; regularpayrate=5.55; overtime=regularpayrate*1.5; overtimepay=overtime*overtimehours; regularpay=regularpayrate*hours; grosspay=regularpay+overtimepay; fedd=grosspay*fed; stated=grosspay*state; totald=stated+fedd; netpay=grosspay-totald;
check_out1(); }}
else if(((strcmp(name,"Rock N Roll")==0)||(strcmp(name,"rock n roll")==0)))
{ cout << "Enter the number of hours that you worked"; cin >> totalhours; if (totalhours>40.00) { overtimehours=totalhours-40.00; hours=40.00; state=0.060; fed=0.220; regularpayrate=5.26; overtime=regularpayrate*1.50; overtimepay=overtime*overtimehours; regularpay=regularpayrate*hours; grosspay=regularpay+overtimepay; fedd=grosspay*fed; stated=grosspay*state; totald=stated+fedd; netpay=grosspay-totald;
check_out1(); } else if ((totalhours<=40)&&(totalhours>0)) { overtimehours=0; hours=totalhours; state=0.060; fed=0.220; regularpayrate=5.26; overtime=regularpayrate*1.5; overtimepay=overtime*overtimehours; regularpay=regularpayrate*hours; grosspay=regularpay+overtimepay; fedd=grosspay*fed; stated=grosspay*state; totald=stated+fedd; netpay=grosspay-totald;
check_out1(); }}
else if(((strcmp(name,"Darth Raiders")==0)||(strcmp(name,"darth raider")==0)))
{ cout << "Enter the number of hours that you worked"; cin >> totalhours; if (totalhours>40.00) { overtimehours=totalhours-40.00; hours=40.00; state=0.004; fed=0.075; regularpayrate=28.00; overtime=regularpayrate*1.50; overtimepay=overtime*overtimehours; regularpay=regularpayrate*hours; grosspay=regularpay+overtimepay; fedd=grosspay*fed; stated=grosspay*state; totald=stated+fedd; netpay=grosspay-totald;
check_out1(); } else if ((totalhours<=40)&&(totalhours>0)) { overtimehours=0; hours=totalhours; state=0.004; fed=0.075; regularpayrate=28.00; overtime=regularpayrate*1.5; overtimepay=overtime*overtimehours; regularpay=regularpayrate*hours; grosspay=regularpay+overtimepay; fedd=grosspay*fed; stated=grosspay*state; totald=stated+fedd; netpay=grosspay-totald;
check_out1(); }}
else if(((strcmp(name,"Oh Masterful One")==0)||(strcmp(name,"oh masterful one")==0)))
{ cout << "Enter the number of hours that you worked"; cin >> totalhours; if (totalhours>40.00) { overtimehours=totalhours-40.00; hours=40.00; state=0.800; fed=0.030; regularpayrate=13.78; overtime=regularpayrate*1.50; overtimepay=overtime*overtimehours; regularpay=regularpayrate*hours; grosspay=regularpay+overtimepay; fedd=grosspay*fed; stated=grosspay*state; totald=stated+fedd; netpay=grosspay-totald;
check_out1(); } else if ((totalhours<=40)&&(totalhours>0)) { overtimehours=0; hours=totalhours; state=0.800; fed=0.030; regularpayrate=13.78; overtime=regularpayrate*1.5; overtimepay=overtime*overtimehours; regularpay=regularpayrate*hours; grosspay=regularpay+overtimepay; fedd=grosspay*fed; stated=grosspay*state; totald=stated+fedd; netpay=grosspay-totald;
check_out1(); }}
else if(((strcmp(name,"Whaz-up")==0)||(strcmp(name,"whaz-up")==0)))
{ cout << "Enter the number of hours that you worked"; cin >> totalhours;
if (totalhours>40.00) { overtimehours=totalhours-40.00; hours=40.00; state=0.888; fed=0.094; regularpayrate=16.66; overtime=regularpayrate*1.50; overtimepay=overtime*overtimehours; regularpay=regularpayrate*hours; grosspay=regularpay+overtimepay; fedd=grosspay*fed; stated=grosspay*state; totald=stated+fedd; netpay=grosspay-totald;
check_out1(); } else if ((totalhours<=40)&&(totalhours>0)) { overtimehours=0; hours=totalhours; state=0.888; fed=0.094; regularpayrate=16.66; overtime=regularpayrate*1.5; overtimepay=overtime*overtimehours; regularpay=regularpayrate*hours; grosspay=regularpay+overtimepay; fedd=grosspay*fed; stated=grosspay*state; totald=stated+fedd; netpay=grosspay-totald;
check_out1(); }
else { cout << "sorry, hours are less than or equal to zero "; calculate(); }
} else if(((strcmp(name,"no")==0)||(strcmp(name,"No")==0)||(strcmp(name,"NO")==0))) { system("cls");
} else { cout << "Username not found, please try again ";//if directions aren't followed input(); } }
void check_out1() {//cout << setprecision(4)<< "Day #"<<j<<":"<<setw(5)<<temp[i][n]<<setw(19)<<(((temp[i][n]-32.0)/9.0)*5.0)<<setw(25)<<(((temp[i][n]*9.0)/5.0)+32.0)<<' '; cout << setprecision(4)<< " /"<<setw(2)<<"//////////////////////////////////////////////////// "; cout << setprecision(4)<< " /"<<setw(2)<<"Rivera ProgrammingCheck#" << i << " Date: August 31, 2001/ "; cout << setprecision(4)<< " /"<<setw(2)<<"C++ Advanced Avenue / "; cout << setprecision(4)<< " /"<<setw(2)<<"Rio Rancho, NM 87124 / "; cout << setprecision(4)<< " /"<<setw(2)<<" / "; cout << setprecision(4)<< " /"<<setw(2)<<"Pay to the order of: " << name <<" / "; cout << setprecision(4)<< " /"<<setw(2)<<"Social Security #: " << security <<setw(33)<<"/ "; cout << setprecision(4)<< " /"<<setw(2)<<" / "; cout << setprecision(4)<< " /"<<setw(2)<<"The amount of:$ " << netpay << setw(33) << "/ "; cout << setprecision(4)<< " /"<<setw(2)<<" "<<setw(51) << "Your master / "; cout << setprecision(4)<< " /"<<setw(2)<<" "<<setw(51) << "0wnz j00 / "; cout << setprecision(4)<< " /"<<setw(2)<<"//////////////////////////////////////////////////// "; i=i+1; cout << "Press a button and press enter to continue "; cin >> j; check_out2(); } void check_out2() { cout << setprecision(4)<< " /"<<setw(2)<<"Total Hours Worked:" << totalhours << " at " << regularpayrate << " per hour "; cout << setprecision(4)<< " /"<<setw(2)<<"Regular Pay: $" << regularpay << " "; cout << setprecision(4)<< " /"<<setw(2)<<"Overtime Pay: $" << overtimepay<< " "; cout << setprecision(4)<< " /"<<setw(2)<<" ----------- "; cout << setprecision(4)<< " /"<<setw(2)<<"Gross Pay: $" << grosspay << " "; cout << setprecision(4)<< " /"<<setw(2)<<"State Tax: $" << stated << " at " << state << "% "; cout << setprecision(4)<< " /"<<setw(2)<<"Federal Tax: $" << fedd << " at " << fed << "% "; cout << setprecision(4)<< " /"<<setw(2)<<"Total Deductions: $" << totald << " "; cout << setprecision(4)<< " /"<<setw(2)<<"Net Pay: $" << netpay << " "; cout << setprecision(4)<< " /"<<setw(2)<<"//////////////////////////////////////////////////// "; end(); }
void end() { cout << " Thank you for choosing Rivera Programmings Products. w00t! "; }
void open_outfile() { outfile.open("payroll outfile.txt", ios::out);//opens outfile title(); }//end of function
void open_infile() {infile.open ("payroll infile.txt", ios::out);//opens infile
}//end function
void close_infile() { infile.close(); close_outfile(); }//end function
void close_outfile() { outfile.close(); }//end of function::end of program

New Topic/Question
Reply




MultiQuote



|