FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

cpp-programming/OOP1-Lab5 at main · whshi574/cpp-programming · GitHub

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Practical Lab Assignment

  1. Write a program to calculate area of a circle using functions.

    area = (atan(1) * 4) * (pow(radius, 2));

    GET the PI value

    atan(1) = PI/4 * 4 = PI

    Pow

    Use pow function to exponentiation.

  2. Write a program to swap two values using functions.

  3. Write a program to convert time to minutes using functions. (input 3 variables namely hours, minutes and seconds. Convert everything into minutes.)

    Cin.fail Cin.clear Cin.ignore

    We can use this cin function to judge the user input's correctless. If cin.fail is 1, maybe our input type is wrong with the store variable type.

    cin.clear(); // Clear the error state

    cin.ignore(std::numeric_limitsstd::streamsize::max(), '\n');//clear all input in the string buffer

  4. Write a program to sum the series up to n (Input n)


Back | FazBrowse Home | New Git URL