Final Examination - Computer Fundamentals & Programming (Simara, Danilo III B.)
Final Examination - Computer Fundamentals & Programming (Simara, Danilo III B.)
int main() {
std::cout << "Hello World!";
return 0;
}
/* This is a comment used for Multi-line Comments, wherein is commonly used for
longer comments in a code*/
1
3. How do you create a variable with the floating number 2.8?
The variable will be double myFloatNum = 2.8 /*Floating point number (with
decimals)*/
Example:
#include <iostream>
using namespace std;
int main() {
double myFloatNum = 2.8;
cout << myFloatNum;
}
Example:
#include <iostream>
#include <string>
using namespace std;
int main() {
//I will use clothing brands as a variable
string brands [3] = {"Bench", "Penshoppe", "Fubu"} ; //The variable and values on it
cout << brands[0];
return 0;
}
2
5. Which keyword is used to create a class in C++?
Example:
#include <iostream>
using namespace std;
int main() {
MyClass myObj; // Create an object of MyClass