Programming Compilation Ren and Mudag
Programming Compilation Ren and Mudag
Mudag, Mohamad M.
Banac, Renebert T.
Table of Contents Page
Activity 1 2
Activity 2 3
Activity 3 5
Activity 4 5
Activity 5 7
Activity 6 8
Activity 7 10
Activity 8.1 12
Activity 8.2 13
Activity 8.3 14
Activity 8.4 15
Activity 9.1 16
Activity 9.2 18
Activity 10 20
1
TOPIC
Contents
Disctiption
Figure
Sample
2
ACTIVITY 1 Create a program that will display your: Name, Age, ID Number,
School Background.
#include <iostream>
Using namespace std;
Int main() {
Return 0;
}
ACT 1. OUTPUT
ACTIVITY 2 Declare a variable from Act 1, Display all values using Variables.
#include <iostream>
#include <string>
Using namespace std;
Int main() {
Return 0;
}
Identification as
Print Partner Print
Mohammad M. Mudag
Start Identification
& Renebert T.Banac
1, and 2
Print
ACT:2 OUTPUT End Elschool1,and
Elschool2
5
ACITIVITY 3 Series
#include<iostream>
Using namespace std;
Int main()
{
Int x=10;
Float y=12.5;
Float z=(x+y);
Cout<<z*z;
Return 0;
}
ACT 3. OUTPUT
#include<iostream>
Using namespace std;
Int main() {
string name, age, id, background;
Return 0;
}
End
ACT 4. OUTPUT
7
#include <iostream>
Using namespace std;
Int main() {
Int age;
String name;
Return 0;
}
Check if age
Print voting is greater
Start success than 0r = to
18
ACT 5. OUTPUT
8
Int main() {
String signin, password;
Int numeral1, numeral2;
Char op;
If (signin == “ALBERTEINSTEIN”) {
Cout << “Insert Password: “;
Cin >> password;
If (password == “CHARLESBABBAGE”) {
Cout << “SIGNING IN….”;
} else {
Cout << “WRONG PASSWORD. TRY AGAIN.”;
}
} else {
Cout << “INVALID USERNAME”;
}
Cout << “\n\t\t SCIENTIFIC CALCULATOR \t\t” << endl;
Cout << “INSERT VALUE NUMERAL 1: “;
Cin >> numeral1;
Cout << “+|-|*|/”;
Cin >> op;
Cout << “INSERT VALUE NUMERAL 2: “;
Cin >> numeral2;
If (op == ‘+’) {
Cout << numeral1 + numeral2;
} else if (op == ‘*’) {
Cout << numeral1 * numeral2;
} else {
Cout << “Invalid operator”;
}
Cout << endl;
Return 0;
9
Check if yes
Scientifi Input
Start c Sign in sign in is
ALBERTE passwor
calculato d
INSTEIN
Check if
Input num1, and Scientifi yes password
Sign in is
num2 c
calculato CHARLES
BABBAG
no
If op is ‘+’ If op is ‘*’
perform perform Wrong
addition & multiplicati password
print result on & print
If op is ‘*’
perform
multiplicati End
on & print
ACT 6. OUTPUT
10
#include<iostream>
Using namespace std;
Int main()
{
String ATTIRE, BATMANORSUPERMAN, LEATHERORCANDY;
Cout<<”Attire (COSTUME or JACKET): “;
Cin>>ATTIRE;
If(ATTIRE == “COSTUME”){
Cout<<”What costume would you like to wear? (BATMAN or SUPERMAN): “;
Cin>>BATMANORSUPERMAN;
If (BATMANORSUPERMAN == “BATMAN”){
Cout<<”BATMAN COSTUME”;
}
Else if (BATMANORSUPERMAN== “SUPERMAN”) {
Cout<<”SUPERMAN COSTUME”;
}
Else {
Cout<<”Please, Try again.”;
}
}
Else if (ATTIRE == “JACKET”){
Cout<<”What type of jacket would you like to wear? (LEATHER or CANDY):
“;
Cin>>LEATHERORCANDY;
If(LEATHERORCANDY == “LEATHER”){
Cout<<”LEATHER JACKET”;
}
Else if (LEATHERORCANDY== “CANDY”) {
Cout<<”CANDY JACKET”;
}
Else {
Else {
Cout<<”Please, try again”;
11
Start
Input Attire=
Attire attire Attire Costume
Candy
Leather Type Attire=Jacket Type Display
Jacket
Display End
End Display
Candy
Jacket
ACT 7. OUTPUT
12
#include<iostream>
Using namespace std;
Int main()
{
For(int x=0; x<=100; x++){
Cout<<x<<endl;
Return 0;
}
Check
Initialize x to 0 if x is < Print the
Start
or =100 value of x
ACTIVITY 8.2
#include<iostream>
Using namespace std;
Int main()
{
For(int x=0; x<=18; x++){
Cout<<”Ren & Mudag”<<x<<endl;
}
Return 0;
}
ACTIVITY 8.3
#include <iostream>
Using namespace std;
Int main() {
For (int I = 1; I <= 100; I += 2) {
Cout << I << “ “;
}
Print the
Start Initialize i to 1 Check if i is value of i
< or = to 100 followed y a
space
ACTIVITY 8.4
#include <iostream>
Using namespace std;
Int main() {
For (int I = 2; I <= 100; I += 2) {
Cout << I << “ “;
}
Print the
Check if i is value of i
Start Initialize i to 2 < or = to 100 followed y a
space
#include<iostream>
Using namespace std;
Int main()
{
Int e;
Int r;
Check if
Initialize e to 1 e is < or Initialize r to 1
Start
equal to
17
Check if
the inner Print Check if r
condition is ‘’*’’ is< or equal
still true to 5
Check if the
outer loop
condition is
still true
Repeat the
inner loop
until r is
greater than
Check if the
outer loop
End
condition is
still true
ACTIVITY 9.2
#include<iostream>
Using namespace std;
Int main()
{
Int e;
Int r;
Check if e
is<or= 5
19
Check if
Print Check if r is
the inner
‘’*’’ > or = e
loop
condition is
Check if the
outer loop
condition is
still true
Repeat the
inner loop
until r is
greater than
Repeat the
End outer loop
until e is >5
ACT 9.2 OUTPUT