CP-lab#7_Quraish_En_065.docx - Bahria University Lahore Campus Department of Computer Science Lab Journal 08(Fall 2018 Course Course Code Faculty\u2019s

CP-lab#7_Quraish_En_065.docx - Bahria University Lahore...

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

Bahria University, Lahore Campus Department of Computer Science Lab Journal 08 (Fall 2018) Course: Computer Programming Lab Date: _______________ Course Code: CSL-113 Max Marks: 30 Faculty’s Name: Aasim Ali Lab Engineer: Zupash Awais Name: Quraish Ameer Enroll No: 03-134192-065 Class: BSCS 2(b) 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 ----------------------------- For Instructor Use Only -----------------------------------Lab Grading Sheet : Task Max Mark s Obtained Marks Comments( if any ) 1. 10 2. 10 3. 10 Total 30 Signature: Note : Attempt all tasks and get them checked by your Lab. Instructor.
Image of page 1
Enrollment Number: ____________________________
Image of page 2
Image of page 3

You've reached the end of your free preview.

Want to read all 5 pages?

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

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture