-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPredefinedFunctionsDEMO.cpp
More file actions
48 lines (35 loc) · 1.49 KB
/
Copy pathPredefinedFunctionsDEMO.cpp
File metadata and controls
48 lines (35 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//************************************************************************
// Author: Rolando Carreon
// Date: mar 4 2025
// Language: C++
// Assignment: PredefinedfunctionsDEMO
// Description: demonstarte a few predefined functions
//************************************************************************
#include<iostream>
#include<cmath> // use for math functions
using namespace std;
int main()
{
// declare local variables
int myInt = 5;
double myDouble = 3.2;
char myChar = 'A';
cout << "Ceiling function " << ceil(myDouble) << endl; // rounds up
cout << "Floor function" << floor(myDouble) << endl; // rounds down
cout << "Power function " << pow(myInt, 3) << endl; // power exponent
cout << "Square root function " << sqrt(25) << endl; // square root
// alternate square root using power exponent
// cout << "Square root function " << sqrt( pow(myInt, 2) ) << endl;
// captures myChar binary dec. conversion number instead of myChar letter
// cout << "To Lower Function " << tolower(myChar) << endl;
// use static cast instead to get just char
cout << "To Lower Function " << static_cast<char>(tolower(myChar))
<< endl;
// insert only upper case number
// if(letter = 65 && letter <= 90)
// return letter + 32 // convert it to lower case
// insert only lower case number
// if(letter = 97 && letter <= 122)
// return letter - 32 // convert it to upper case
return 0;
}