Lab 9.docx - Bahria University Lahore Campus Department of Computer Science Lab Journal 09(spring 2020 Course Course Code Faculty\u2019s Name Computer

Lab 9.docx - Bahria University Lahore Campus Department of...

This preview shows page 1 - 3 out of 4 pages.

Bahria University, Lahore Campus Department of Computer Science Lab Journal 09 (spring 2020) Course: Computer Programming Lab Date: _______________ Course Code: CSL-113 Max Marks: 20 Faculty’s Name: Lab Engineer: Tayyab Mir Name: _____________________ Enroll No: ___________________ Class: ______________ Objective(s): To Understand about: 1. Apply user defined functions in C++ 2. Function declaration, calling and definition. 3. Functions with Side Effects 4. Functions with Return Value Lab Tasks: Example #1 Example #2 #include<iostream> using namespace std; int add(); int add() { int a, int b; cin>>a >>b; cout<<”sum: ”<<a+b; } int main() { cout<<add(); system("pause"); return 0; } #include<iostream> using namespace std; int add(int a,int b); int add(int a, int b) { return (a+b); } int main() { cout<<add(10,7); system("pause"); return 0; } Output: 10 7 sum:17 Output: 17
Image of page 1
Enrollment Number: ____________________________ **Provide solution of each task and screenshot of output at the end of that task**
Image of page 2
Image of page 3

You've reached the end of your free preview.

Want to read all 4 pages?

  • Spring '19
  • ASIM ALI
  • Addition, Return statement, Void type, Carriage return

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture