Hi,
I am used to writing code as 1 function but now I need to split inputs calculations and outputs into seperate functions.
Could somebody show me how to do this using this code.
PHP Code:
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
// *********************************************
// Date - Name - Description
// 20/10/10 - Toby Curran - Practice
// *********************************************
void main()
{
int Width = 0;
int Length = 0;
int Offices = 0;
int Cost = 0;
int Carpet = 0;
int Price = 0;
printf("Enter the width of the office ");
scanf("%d", &Width);
fflush(stdin);
printf("\nEnter the length of the office ");
scanf("%d", &Length);
fflush(stdin);
printf("\nEnter the number of offices on the floor ");
scanf("%d", &Offices);
fflush(stdin);
printf("\nEnter the price of the carpet per meter square ");
scanf("%d", &Cost);
fflush(stdin);
Carpet = Width * Length * Offices;
printf("\n\nCarpet is: %d", Carpet);
Price = Width * Length * Offices * Cost;
printf("\n\nPrice is: %d", Price);
getch();
}
Thanks