Share
Explore BrainMass

Example of a Flow Chart and Written Specification of a C Program

I need an example of a flow chart and specification sheet of a C program.

Here is an example of a C program:

/*Currency conversion.*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <system.h>
main ()
{
/* Data Declaration statements*/

int Curr_type;
float For_curr;
float Equ_curr;

printf("CURRENCY CONVERTERn");
printf("Choose currency optionn");
printf("Press 1 for MXN: Mexican Peson");
printf("Press 2 for JPY: Japanese Yenn");
printf("Press 3 for HKD: Hong Kong Dollarsn");
printf("Press 4 for KRW: Korean Wonn");
printf("Press 5 for PHP: Philippine Peson");
printf("Enter the type of currency:");
scanf("%d", &Curr_type);/* & symbol assigns L-H and R-H to the left hand quantity*/
printf("Enter the amount of money that you would like to convert to USD:");
scanf("%f", &For_curr);

/* Switch statement to Case Curr_type (1, 2, 3, 4, 5)*/
switch(Curr_type)
{

/* MXN: Mexican Peso */
case 1:
Equ_curr = ((For_curr) * (0.08764));
printf ("The equivalent of %.2f MXN is %.2f USD n", For_curr, Equ_curr);
break; /* Jump to end of switch*/

/* JPY: Japanese Yen */
case 2:
Equ_curr = ((For_curr) * (0.009093));
printf ("The equivalent of %.2f JPY is %.2f USD n", For_curr, Equ_curr);
break; /* Jump to end of switch*/

/* HKD: Hong Kong Dollars */
case 3:
Equ_curr = ((For_curr) * (0.1283));
printf ("The equivalent of %.2f HKD is %.2f USD n", For_curr, Equ_curr);
break; /* Jump to end of switch*/

/* KRW: Korean Won */
case 4:
Equ_curr = ((For_curr) * (0.0008591));
printf ("The equivalent of %.2f KRW is %.2f USD n", For_curr, Equ_curr);
break; /* Jump to end of switch*/

/* PHP: Philippine Peso */
case 5:
Equ_curr = ((For_curr) * (0.01791));
printf ("The equivalent of %.2f PHP is %.2f USD n", For_curr, Equ_curr);
break; /* Jump to end of switch*/

} /*end switch */
getch ();
return (0);
}

Solution Summary

An example of a flow chart and written specification of a C program is given in an attached Word document.

$2.19