Coding of c++ in object oriented programming, Study notes of Computer Programming

Coding related to c++ which is useful while studying

Typology: Study notes

2022/2023

Available from 08/23/2023

pavithra-7
pavithra-7 🇮🇳

1 document

1 / 4

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
pf3
pf4

Partial preview of the text

Download Coding of c++ in object oriented programming and more Study notes Computer Programming in PDF only on Docsity!

Experiment-1 Function with default argument AIM: To write a c++ program to implementing function with default argument. ALGORITHM :- STEP 1:- start the program. STEP2:- the function sum is defined with four input as X,¥,Z,W with 0 as default value for Zand W. STEP3:- the function sum finds the sum of the value X+¥+Z+W. STEP4:- the function sum is called with 2,3 or 4 inputs. STEPS:- stop the program. Program: #include #include // A function with default arguments, it can be called with /! 2 arguments or 3 arguments or 4 arguments. int sum(int x, int y, int z=0, int w=0) return (x +y+z+ Ww); } /* Driver program to test above function*/ void main() { cout << sum(10, 15) << endl; cout << sum(10, 15, 25) << endl; cout << sum(10, 15, 0) << endl; getch(); Output: