Docsity

Object Oriented Programming || C++ & Function, Slides of Computer Science

Partial preview of the text

Download Object Oriented Programming || C++ & Function and more Slides Computer Science in PDF only on Docsity!

Dipit Saha, BUET CSE

Introduction to C++ (Part 2)

& Functions

Lecture-

Solution of using get line

string.length()

Setprecision ( Need to use a new library)

fixed , scientific

scientific ,setprecision

Problem You are tasked with creating a program that takes a floating-point number (123.456789) then displays the number in various formats. Output:

Function ….....

Problem Write a C++ program that asks the user to input the length and width of a rectangle, and then calculates its area using a function.

Inline function In C++, an inline function is a function for which the compiler attempts to generate code that directly replaces the function call with the actual code of the function. This is done in order to eliminate the overhead of function calls, which can be significant in certain situations (such as in small functions called frequently).

Inline function