Comprog Plates

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 8

Name: Course & Year Level: BSCE-CEM 2A

Course No. & Description: ES 212- Computer Programming 1 Schedule: TTh (7:30-9:00 am)
Plate Number & Title: PLATE # 1 - INTRODUCTION Rating:

#include < iostream >

using namespace std;

int main ( )

cout<< “Hi, my name is Rocelle Ralph D.Ogoc”<<endl;

cout<< “20 years old. I live in”<<endl;

cout<< “Comunal, Liloy, Zambaonga Del Norte”<<endl;

Return 0;

}
Name: Rocelle Ralph D.Ogoc Course & Year Level: BSCE–CEM 2A
Course No. & Description: ES 212-Computer Programming 1 Schedule: TTh (7:30-9:00 am)
Plate Number & Title: PLATE # 2 - DECLARATION OF VARIABLES Rating:

STRING

#include <iostream>

using namespace std;

int main ( ) {

string x = "Rocelle";

string y = "Civil Engineering student";

string z = "2nd year ";

cout<< x << " is a " << z << y;

return 0; }

CHAR

#include <iostream>

using namespace std;

int main ( ) {

char age = ‘A’;

cout << “ My age is:” << age;


return 0; }

BOOL

#include <iostream>

using namespace std;

int main ( ) {

bool b1 = true;

bool b2 = false;

cout << b1 << “ , “ << b2;

return 0; }

INT

#include <iostream>

using namespace std;

int main ( ) {

int smallest = 100;

int largest = 200;

cout << “Smallest Number:” << smallest << ”\n”;

cout << “Largest Number:” << largest << “\n”;return 0; }


FLOAT

#include <iostream>

using namespace std;

int main ( ) {

int num = 9;

float a,b;

a = num/4;

b= num/4.0;

cout << “ a value= ” << a << endl;

cout << “ b value= ” << b << endl;

return 0; }

DOUBLE

#include <iostream>

using namespace std;

int main() {

double n_1, n_2;

cout << "First_Number to be entered as a double type: ";

cin >> n_1;


cout << "Second_Number to be entered as a double type: ";

cin >> n_2;

Name: Rocelle Ralph D.Ogoc Course & Year Level: BSCE-CEM 2A


Course No. & Description: ES 212-Computer Programming 1 Schedule: TTh (7:30-9:00 am)
Plate Number & Title: Plate # 3 – BASIC COMPUTATIONS Rating:

cout << "Sum of both the numbers entered: " << (n_1+n_2);

return 0; }

AREA OF RECTANGLE

#include <iostream>

using namespace std;

int main( ) {

float len, wid, area;

cout<<"Enter Length of Rectangle: ";

cin >> len;

cout << "Enter Width of Rectangle: ";

cin >> wid;

area = len*wid;

cout<< " \nArea = " << area;

cout << endl; return 0; }

PERIMETER OF RECTANGLE

#include <iostream>

using namespace std;

int main ( ) {
float len, wid, per;

cout<<"Enter Length and Width of Rectangle: ";

cin >> len >> wid;

per = 2*(len+wid);

cout << " \nPerimeter = " << per;

cout << endl; return 0; }

AREA OF TRIANGLE

#include <iostream>

using namespace std;

int main( ) {

float b, h, area;

cout<< "Enter Base length of Triangle: ";

cin >> b;

cout << "Enter Height length of Triangle: ";

cin >> h;

area = 0.5*b*h;

cout << "\nArea = " << area;

cout << endl;

return 0; }
Name: Rocelle Ralph D.Ogoc Course & Year Level: BSCE-CEM 2A
Course No. & Description: ES 212-Computer Programming 1 Schedule: TTh (7:30-9:00 am)
Plate Number & Title: PLATE # 4 - ARRAYS Rating:

INT ARRAY

# include <iostream>

using namespace std;

int main ( ) {

int arr[ ] = {11, 22, 33, 44, 55};

cout<<arr[0]<<endl;

cout<<arr[1]<<endl;

cout<<arr[2]<<endl;

cout<<arr[3]<<endl;

cout<<arr[4]<<endl;

return 0; }

STRING ARRAY

#include <iostream>

using namespace std;

int main ( ) {

string subject[ ] = {"English","Math","Filipino","Mapeh","History"};


cout<<subject[0]<<endl;

cout<<subject[1]<<endl;

cout<<subject[2]<<endl;

cout<<subject[3]<<endl;

cout<<subject[4]<<endl;

return 0; }

You might also like