COULIX un pc pour les attirer ... | Musaran a écrit :
Code :
- struct employe
- {
- char nom[256];
- int id;
- float paye_horaire;
- };
- employe* LesEmployes= new employe[n];
|
Pour le reste, tu dois bien avoir des cours ?
Je regardes ton exam... tu n'as pas encore vu switch ?
|
j ai fait comme ci dessous, cela marche, mais le tableau n est pas dynamique, et je cherche comment obtenir la partie decimal d un input, pour le calcul de l heure.
par example si il entre 3.45 , ce qui correspond a 3 h et 45 , qui doit etre ' convertie en 3.75...
je cherche toujours.
Code :
- #include <iostream>
- #include <string>
- //double converthours (double a);
- void process(double inputdbl[][3],int a) {
- double result, extra, withouttax;
- double hours = inputdbl[a][0];
- double tax = inputdbl[a][1];
- double rate = inputdbl[a][2];
- if (inputdbl[a][0] > 40 ) {
- extra=(hours-40)*(1.5*rate);
- withouttax = (40*rate)+ extra;
- result = withouttax - (withouttax *(tax/100)); }
- else {
- withouttax=(hours*rate);
- result = (withouttax - (hours*rate*(tax/100))); }
- cout << " ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹\n";
- cout << " º NET PAYE : " << result << " $ \n";
- cout << " ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹\n";
- cout << " º GROSS PAY : " << withouttax <<" $ \n";
- cout << " ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹\n";
- cout << " º TAX : " << withouttax - result<<" $ \n";
- cout << " ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹\n";
- cout << " º PAY RATE : " << "?????" <<" $ \n";
- cout << " ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ\n";
- }
- void recordinput (string inputstr[][2], double inputdbl[][3],int a) {
- cout << "\n";
- cout << "Employee ID (no space, use _) :? "; cin >> inputstr[a][0];
- cout << "Employee Name (no space, use _) :? "; cin >> inputstr[a][1];
- cout << "Hours Worked [hours],[min] :? "; cin >> inputdbl[a][0];
- cout << "TAX [%]? :? "; cin >> inputdbl[a][1];
- cout << "Employee hourly pay :? "; cin >> inputdbl[a][2];
- cout << "\n";
- }
- int main()
- {
- string inputstr[10][2];
- double inputdbl[10][3];
- int n=0;
- string answer,quit;
- do {
- do {
- recordinput (inputstr,inputdbl,n);
- cout << "Add an other employee ?";
- cin >> answer;
- cout << "\n";
- if (answer == "y" ) { n++;}
- }
- while (answer == "y" );
-
- for(int i=0;i<n+1;i++) {
- cout << " ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»\n";
- cout << " º ID : " << inputstr[i][0] << "\n";
- cout << " ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹\n";
- cout << " º HOURS WORKED : " << inputdbl[i][0] << "\n";
- process(inputdbl,i);
- cout << "\n";
- }
- cout << "quit ? \n";
- cin >> quit;
- }
- while(quit != "y" );
- }
|
les cours que l on as c le bouquin .. Message édité par COULIX le 16-01-2003 à 06:03:49
|