/*
========================================================
COMPILATION SUCCESSFUL
Submitted on: 20021212 at: 15:34:34 from: 10.0.0.26
========================================================
*/
// AUTHOR: ROSITA GUIDERA
// DATE: 28 November 2002
// BRIEF: Assignment one
// NOTE: May need -lncurses argument to gcc to compile
#include
main ()
{
int num,max,total, fifties, twenties, tens, fives, twos, ones, fiftyc, twentyc;
int tenc, fivec, twoc, onec,remainder, pennies;
float amount;
int total_fifties, total_twenties, total_tens, total_fives, total_twos;
int total_ones, total_fiftyc, total_twentyc, total_tenc, total_fivec;
int total_twoc, total_onec;
char preference;
char eol;
total_fifties=0;
total_twenties=0;
total_tens=0;
total_fives=0;
total_tens=0;
total_fives=0;
total_twos=0;
total_ones=0;
total_fiftyc=0;
total_twentyc=0;
total_tenc=0;
total_fivec=0;
total_twoc=0;
total_onec=0;
printf("Voulez vous Francais (F) ou Anglais (A)?\nWould you prefer French (F) or English (E)?\n");
scanf ("%c",&preference);
if ((preference == 'e')||(preference == 'E') || (preference == 'a') || (preference == 'A'))
{
// English Version of Program
printf (" How many Employees will there be?: \n");
scanf ("%d", &total);
num=1;
//total=2;
while(num<=total)
{
printf ("Please enter a value: ");
scanf ("%f%c", &amount, &eol);
fifties = amount/50;
total_fifties = total_fifties + fifties;
pennies = amount * 100 + .1;
remainder = pennies % 5000;
twenties = remainder / 2000;
total_twenties= total_twenties + twenties;
remainder = remainder % 2000;
remainder++;
tens = remainder / 1000;
total_tens = total_tens + tens;
remainder = remainder % 1000;
fives = remainder / 500;
total_fives = total_fives + fives;
remainder = remainder % 500;
twos = remainder / 200;
total_twos = total_twos + twos;
remainder = remainder % 200;
ones = remainder / 100;
total_ones = total_ones + ones;
remainder = remainder % 100;
fiftyc = remainder / 50;
total_fiftyc = total_fiftyc + fiftyc;
remainder = remainder % 50;
twentyc = remainder / 20;
total_twentyc = total_twentyc + twentyc;
remainder = remainder % 20;
tenc = remainder / 10;
total_tenc = total_tenc + tenc;
remainder = remainder % 10;
fivec = remainder / 5;
total_fivec = total_fivec + fivec;
remainder = remainder % 5;
twoc = remainder / 2;
total_twoc = total_twoc + twoc;
remainder = remainder % 2;
onec = remainder / 1;
total_onec = total_onec + onec;
printf ("The number of fifties is: %d\n", fifties);
printf ("The number of twenties is: %d\n", twenties);
printf ("The number of tens is: %d\n", tens);
printf ("The number of fives is: %d\n", fives);
printf ("The number of twos is: %d\n", twos);
printf ("The number of ones is: %d\n", ones);
printf ("The number of 50 cents is: %d\n", fiftyc);
printf ("The number of 20 cents is: %d\n", twentyc);
printf ("The number of 10 cents is: %d\n", tenc);
printf ("The number of 5 cents is: %d\n", fivec);
printf ("The number of 2 cents is: %d\n", twoc);
printf ("The number of 1 cents is: %d\n", onec);
num ++;
}
printf ("\n");
printf ("The total number of fifties is: %d\n",total_fifties);
printf ("The total number of twenties is: %d\n", total_twenties);
printf ("The total number of tens is: %d\n", total_tens);
printf ("The total number of fives is: %d\n", total_fives);
printf ("The total number of twos is: %d\n", total_twos);
printf ("The total number of ones is: %d\n", total_ones);
printf ("The total number of fiftyc is: %d\n", total_fiftyc);
printf ("The total number of twentyc is: %d\n",total_twentyc);
printf ("The total number of tenc is: %d\n", total_tenc);
printf ("The total number of fivec is: %d\n", total_fivec);
printf ("The total number of twoc is: %d\n", total_twoc);
printf ("The total number of onec is: %d\n", total_onec);
printf ("\n");
}
else
{ //French Version of The Program
printf ("Comment beaucoup d'Employ� il y aura? : \n");
scanf ("%d%c", &total, &eol);
num=1;
//total=10;
while(num<=total)
{
printf ("S'il vous plait entre une valeur?: ");
scanf ("%f%c", &amount, &eol);
fifties = amount/50;
total_fifties = total_fifties + fifties;
pennies = amount * 100 + .1;
remainder = pennies % 5000;
twenties = remainder / 2000;
total_twenties= total_twenties + twenties;
remainder = remainder % 2000;
remainder++;
tens = remainder / 1000;
total_tens = total_tens + tens;
remainder = remainder % 1000;
fives = remainder / 500;
total_fives = total_fives + fives;
remainder = remainder % 500;
twos = remainder / 200;
total_twos = total_twos + twos;
remainder = remainder % 200;
ones = remainder / 100;
total_ones = total_ones + ones;
remainder = remainder % 100;
fiftyc = remainder / 50;
total_fiftyc = total_fiftyc + fiftyc;
remainder = remainder % 50;
twentyc = remainder / 20;
total_twentyc = total_twentyc + twentyc;
remainder = remainder % 20;
tenc = remainder / 10;
total_tenc = total_tenc + tenc;
remainder = remainder % 10;
fivec = remainder / 5;
total_fivec = total_fivec + fivec;
remainder = remainder % 5;
twoc = remainder / 2;
total_twoc = total_twoc + twoc;
remainder = remainder % 2;
onec = remainder / 1;
total_onec = total_onec + onec;
printf ("Le numbre cinquante est: %d\n",fifties);
printf ("Le numbre total de Vingt est: %d\n", twenties);
printf ("Le numbre total de Dizaines est: %d\n", tens);
printf ("Le numbre total de Cinq est: %d\n", fives);
printf ("Le numbre total de Deux est: %d\n", twos);
printf ("Le numbre total d'une est: %d\n", ones);
printf ("Le numbre total de cinquante cents est: %d\n", fiftyc );
printf ("Le numbre total de vingt cents est: %d\n", twentyc);
printf ("Le numbre total de dix cents est: %d\n", tenc);
printf ("Le numbre total de cinq cents est: %d\n", fivec);
printf ("Le numbre total de deux cents est: %d\n", twoc);
printf ("Le numbre total d'un cents est: %d\n", onec);
num ++;
}
printf ("\n");
printf ("Le numbre total cinquante est: %d\n", total_fifties);
printf ("Le numbre total de vingt est: %d\n", total_twenties);
printf ("Le numbre total de dizaines est: %d\n", total_tens);
printf ("Le numbre total de cinq est : %d\n", total_fives);
printf ("Le numbre total de deux est: %d\n", total_twos);
printf ("Le numbre total d'une est: %d\n", total_ones);
printf ("Le numbre total de cinquante cents est: %d\n", total_fiftyc);
printf ("Le numbre total de vingt cents est: %d\n", total_twentyc);
printf ("Le numbre total de dix cents est: %d\n", total_tenc);
printf ("Le numbre total de cinq cents est: %d\n", total_fivec);
printf ("Le numbre total de deux cents est: %d\n", total_twoc);
printf ("Le numbre total d'un cents est: %d\n", total_onec);
printf ("\n");
}
}