SlideShare a Scribd company logo
1 of 2
#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

What's hot

Lukáš Šabľa - Vim
Lukáš Šabľa - VimLukáš Šabľa - Vim
Lukáš Šabľa - Vim
webelement
 
5 1. character processing
5 1. character processing5 1. character processing
5 1. character processing
웅식 전
 

What's hot (18)

Lukáš Šabľa - Vim
Lukáš Šabľa - VimLukáš Šabľa - Vim
Lukáš Šabľa - Vim
 
Oop1
Oop1Oop1
Oop1
 
timingExercise
timingExercisetimingExercise
timingExercise
 
Go Concurrency
Go ConcurrencyGo Concurrency
Go Concurrency
 
Ic engine(piston design) in C++ and C language
Ic engine(piston design) in C++ and C languageIc engine(piston design) in C++ and C language
Ic engine(piston design) in C++ and C language
 
Loops (1)
Loops (1)Loops (1)
Loops (1)
 
Scaling FastAGI Applications with Go
Scaling FastAGI Applications with GoScaling FastAGI Applications with Go
Scaling FastAGI Applications with Go
 
Go Containers
Go ContainersGo Containers
Go Containers
 
Array using recursion
Array using recursionArray using recursion
Array using recursion
 
Assignment 3
Assignment 3Assignment 3
Assignment 3
 
PHP in 2018 - Q1 - AFUP Limoges
PHP in 2018 - Q1 - AFUP LimogesPHP in 2018 - Q1 - AFUP Limoges
PHP in 2018 - Q1 - AFUP Limoges
 
Rcpp11 useR2014
Rcpp11 useR2014Rcpp11 useR2014
Rcpp11 useR2014
 
user2015 keynote talk
user2015 keynote talkuser2015 keynote talk
user2015 keynote talk
 
Sol10
Sol10Sol10
Sol10
 
Gc in golang
Gc in golangGc in golang
Gc in golang
 
Inc decsourcefile
Inc decsourcefileInc decsourcefile
Inc decsourcefile
 
Gc in golang
Gc in golangGc in golang
Gc in golang
 
5 1. character processing
5 1. character processing5 1. character processing
5 1. character processing
 

Similar to Function paint

Programming - Marla Fuentes
Programming - Marla FuentesProgramming - Marla Fuentes
Programming - Marla Fuentes
mfuentessss
 

Similar to Function paint (10)

The Ring programming language version 1.9 book - Part 128 of 210
The Ring programming language version 1.9 book - Part 128 of 210The Ring programming language version 1.9 book - Part 128 of 210
The Ring programming language version 1.9 book - Part 128 of 210
 
2 BytesC++ course_2014_c3_ function basics&parameters and overloading
2 BytesC++ course_2014_c3_ function basics&parameters and overloading2 BytesC++ course_2014_c3_ function basics&parameters and overloading
2 BytesC++ course_2014_c3_ function basics&parameters and overloading
 
Project in programming
Project in programmingProject in programming
Project in programming
 
The Ring programming language version 1.5.4 book - Part 86 of 185
The Ring programming language version 1.5.4 book - Part 86 of 185The Ring programming language version 1.5.4 book - Part 86 of 185
The Ring programming language version 1.5.4 book - Part 86 of 185
 
Add a function prototype for the function sumNum- # include using nam.docx
Add a function prototype for the function sumNum- # include  using nam.docxAdd a function prototype for the function sumNum- # include  using nam.docx
Add a function prototype for the function sumNum- # include using nam.docx
 
Virtual inheritance
Virtual inheritanceVirtual inheritance
Virtual inheritance
 
Un monde où 1 ms vaut 100 M€ - Devoxx France 2015
Un monde où 1 ms vaut 100 M€ - Devoxx France 2015Un monde où 1 ms vaut 100 M€ - Devoxx France 2015
Un monde où 1 ms vaut 100 M€ - Devoxx France 2015
 
Flyweight Design Pattern
Flyweight Design PatternFlyweight Design Pattern
Flyweight Design Pattern
 
Programming - Marla Fuentes
Programming - Marla FuentesProgramming - Marla Fuentes
Programming - Marla Fuentes
 
Algo
AlgoAlgo
Algo
 

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; }