C++ Function

  • Uploaded by: Mahathir Mohmed
  • 0
  • 0
  • November 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View C++ Function as PDF for free.

More details

  • Words: 200
  • Pages: 5
LAB 4 Lab Exercises 1. Create a C++ program that finds the biggest number between two numbers. Create a function find_bigger(). 2. Modified the program in Question 1 by using the return value.

QUESTION 1 source code /* Name : xxx Date : 280208 Description : Lab 4 Q1 Made with Dev C++ 4.9.9.2 */ #include #include using namespace std; int find_bigger(int, int); int main() { int value1; int value2; cout<<"\nEnter Number : "; cin>>value1; cout<<"\nEnter Number : "; cin>>value2; find_bigger(value1, value2); return 0; } int find_bigger(int x, int y) { int find_bigger = x; if (y > find_bigger) find_bigger = y; cout<<"\nBiggest Value Here is: "<
console application

QUESTION 2 source code /* Name : xxx Date : 280208 Description : Lab 4 Q2 Made with Dev C++ 4.9.9.2 */ #include #include using namespace std; int find_bigger(int, int); int main() { int value1; int value2; int maximum; cout<<"\nEnter Number : "; cin>>value1; cout<<"\nEnter Number : "; cin>>value2; maximum = find_bigger(value1, value2); cout<<"\nBiggest Value Here is: "<<maximum<<endl<<endl; cout<<endl; system ("pause"); } int find_bigger(int x, int y) { int find_bigger = x; if (y > find_bigger) find_bigger = y; }

return find_bigger;

console application

Related Documents

C++ Function
November 2019 22
Function
December 2019 67
Function
November 2019 54
Function
June 2020 25

More Documents from "ong kar weng"

Green Quotes
December 2019 28
December 2019 36
Root Explant
November 2019 31
Botox
November 2019 32