SlideShare a Scribd company logo
#include <iostream>
using namespace std;
float priceperlitre();
void coverageperlitre(float&);
float amtofpaint (float, float);
float cost(float, float);

int main()
{
  float height, width, areaofwall, areaperlitre, price;
  int litre;
  float ppl, harga, aop;

    cout<<"Height: ";
    cin>>height;
    cout<<"Width: ";
    cin>>width;

    areaofwall=height*width;
    cout<<"The area of wall : "<<areaofwall<<endl;

    coverageperlitre(areaperlitre);

    ppl=priceperlitre();

    aop=amtofpaint(areaofwall, areaperlitre);
    cout<<"The amount paint need: "
    <<amtofpaint(areaofwall,areaperlitre)
    <<" liter"<<endl;

    harga=cost(aop, ppl);
    cout<<"The cost is : RM "<<harga<<endl;

    system("pause");
    return 0;
}


float priceperlitre()
{
    float price;
    cout<<"Price paint per litre:RM ";
    cin>>price;

     return price;
}




void coverageperlitre(float& areaperlitre)
{
   cout<<"The area that can be painted by a litre : ";
   cin>>areaperlitre;
}


float amtofpaint (float areaofwall, float areaperlitre)
{
   float litre;

    litre= areaofwall/areaperlitre;
    return litre;
}


float cost(float litre, float price)
{
    float costofpaint;

     costofpaint= litre*price;

     return costofpaint;
}

More Related Content

DOCX
Java Code for Sample Projects Methods
DOCX
Static Variable in C++
PDF
R/C++ talk at earl 2014
PDF
Concurrency in Golang
PDF
Rcpp11 genentech
PDF
Golang Channels
PDF
3 rd animation
Java Code for Sample Projects Methods
Static Variable in C++
R/C++ talk at earl 2014
Concurrency in Golang
Rcpp11 genentech
Golang Channels
3 rd animation

What's hot (18)

PDF
Lukáš Šabľa - Vim
PPT
DOCX
timingExercise
PDF
Go Concurrency
PDF
Ic engine(piston design) in C++ and C language
PPT
Loops (1)
PDF
Scaling FastAGI Applications with Go
PDF
Go Containers
DOCX
Array using recursion
DOCX
Assignment 3
PPTX
PHP in 2018 - Q1 - AFUP Limoges
PDF
Rcpp11 useR2014
PDF
user2015 keynote talk
PDF
Gc in golang
PDF
Inc decsourcefile
PDF
Gc in golang
PDF
5 1. character processing
Lukáš Šabľa - Vim
timingExercise
Go Concurrency
Ic engine(piston design) in C++ and C language
Loops (1)
Scaling FastAGI Applications with Go
Go Containers
Array using recursion
Assignment 3
PHP in 2018 - Q1 - AFUP Limoges
Rcpp11 useR2014
user2015 keynote talk
Gc in golang
Inc decsourcefile
Gc in golang
5 1. character processing
Ad

Function paint

  • 1. #include <iostream> using namespace std; float priceperlitre(); void coverageperlitre(float&); float amtofpaint (float, float); float cost(float, float); int main() { float height, width, areaofwall, areaperlitre, price; int litre; float ppl, harga, aop; cout<<"Height: "; cin>>height; cout<<"Width: "; cin>>width; areaofwall=height*width; cout<<"The area of wall : "<<areaofwall<<endl; coverageperlitre(areaperlitre); ppl=priceperlitre(); aop=amtofpaint(areaofwall, areaperlitre); cout<<"The amount paint need: " <<amtofpaint(areaofwall,areaperlitre) <<" liter"<<endl; harga=cost(aop, ppl); cout<<"The cost is : RM "<<harga<<endl; system("pause"); return 0; } float priceperlitre() { float price; cout<<"Price paint per litre:RM "; cin>>price; return price; } void coverageperlitre(float& areaperlitre) { cout<<"The area that can be painted by a litre : "; cin>>areaperlitre;
  • 2. } float amtofpaint (float areaofwall, float areaperlitre) { float litre; litre= areaofwall/areaperlitre; return litre; } float cost(float litre, float price) { float costofpaint; costofpaint= litre*price; return costofpaint; }