0% found this document useful (0 votes)
9 views12 pages

CC102 FUNDAMENTALS OF PROGRAMMING PROJECT Felix

The document contains a series of laboratory exercises for a programming course, each with source code and program output. Exercises cover basic programming concepts such as input/output, string manipulation, conditional statements, and arithmetic operations. The exercises are designed to help students practice and understand fundamental programming skills.

Uploaded by

davethegreat343
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views12 pages

CC102 FUNDAMENTALS OF PROGRAMMING PROJECT Felix

The document contains a series of laboratory exercises for a programming course, each with source code and program output. Exercises cover basic programming concepts such as input/output, string manipulation, conditional statements, and arithmetic operations. The exercises are designed to help students practice and understand fundamental programming skills.

Uploaded by

davethegreat343
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 12

CC102 FUNDAMENTALS OF

PROGRAMMING
LABORATORY
EXERCISES
COMPILATION

JUZZY D. NICANOR
BSIT-1
Schedule: TTH-2:30PM-5:00PM
LABORATORY EXERCISE 01

SOURCE CODE

#include <iostream>
using namespace std;
int main()

{
cout << "HELLO WORLD" << endl;
return 0;
}

PROGRAM OUTPUT

LABORATORY EXERCISE 02

SOURCE CODE

#include <iostream>
using namespace std;
int main ()
{
string name;
cout << "ENTER YOUR NAME: ";
getline (cin, name);
cout << "YOUR COMPLETE NAME IS: " << name << endl;

return 0;
}

PROGRAM OUTPUT

LABORATORY EXERCISE 03

SOURCE CODE

#include <iostream>
using namespace std;
int main()
{
string fname;
string lname;

cout << "ENTER FIRST NAME: ";


getline (cin, fname);

cout << "ENTER LAST NAME: ";


cin >> lname;
cout << "YOUR COMPLETE NAME IS: " << fname << " "<< lname << endl;

return 0;
}

PROGRAM OUTPUT

LABORATORY EXERCISE 04

SOURCE CODE

#include <iostream>
using namespace std;

int main()
{
string name;
int DaysPresent;
int DailyRate= 368.00;

cout << "NAME OF EMPLOYEE: ";


getline (cin, name);
cout << "ENTER DAYS PRESENT: ";
cin >> DaysPresent;

cout << "SALARY: " << DailyRate * DaysPresent << endl;

return 0;
}

PROGRAM OUTPUT

LABORATORY
EXERCISE 05

SOURCE CODE

#include <iostream>
using namespace std;

int main()
{
float totalBill;
float liquorCharge;
float tipPercentage;

cout << "ENTER TOTAL BILL:" ;


cin >> totalBill;

cout << "ENTER LIQUOR CHARGE: " ;


cin >> liquorCharge;
cout << "ENTER TIP PERCENTAGE: ";
cin >> tipPercentage;

cout << "TOTAL BILL WITHOUT LIQUOR CHARGE:" << totalBill - liquorCharge << endl;

cout << "DISPLAY TIP: " << (totalBill - liquorCharge) * ((tipPercentage) / 100)<< endl;

return 0;
}

PROGRAM OUTPUT
LABORATORY EXERCISE 06

SOURCE CODE

#include <iostream>
using namespace std;

int main()
{
int num1, num2;
cout << "Enter first number:";
cin >> num1;
cout << "Enter second number:" ;
cin >> num2;

if (num1 > num2) {


cout << "The highest number is:" << num1;
} else if (num2 > num1) {
cout << "The highest number is:" << num2;

}else {
cout << "Both numbers are equal." ;
}
return 0;

}
PROGRAM OUTPUT
LABORATORY EXERCISE 07

SOURCE CODE

#include <iostream>
using namespace std;
int main()
{
double annualSales, bonus;

cout << "ENTER SALES: $" ;


cin >> annualSales;

const double bonusRateHigh = 0.02;


const double bonusRateLow = 0.015;

if (annualSales >= 15000)


{
bonus = annualSales * bonusRateHigh;
} else {
bonus = annualSales * bonusRateLow;
}
cout << "Mary's annual bonus is: $" << bonus << endl;

return 0;
}

PROGRAM OUTPUT
LABORATORY EXERCISE 08

SOURCE CODE

#include <iostream>
using namespace std;

int main()
{
int age = 18;
char reg;

cout << "ENTER YOUR AGE:";


cin >> age;

if (age >= 18){


cout << "ENTER REGISTRATION STATUS: ";
cin >> reg;

if (reg == 'Y')
cout << "YOU CAN VOTE";
else
cout << "YOU MUST REGISTER BEFORE YOU CAN VOTE";

}else {
cout << "YOU ARE TOO YOUNG TO VOTE";
}
return 0;
}

PROGRAM OUTPUT
LABORATORY EXERCISE 09

SOURCE CODE

#include <iostream>
using namespace std;
int main(){
char productID;

cout <<"Enter a product ID ( 1, 2, 3, 4,): ";


cin >> productID;

switch (productID) {
case '1':
cout << "Price:P10.00" << endl;
break;
case '2':
cout << "Price:P20.00" << endl;
break;
case '3':
cout <<"Price:P30.00" << endl;
break;
case'4':
cout <<"Price:40.00" <<endl;
break;

default:
cout <<"Invalid Product ID:" << endl;
}
return 0;
}

PROGRAM OUTPUT
LABORATORY EXERCISE 10

SOURCE CODE

#include <iostream>
#include<math.h>
using namespace std;
int main()
{
double a,b,c,sum;

cout <<"ENTER THE FIRST NUMBER: ";


cin >>a;

cout <<"ENTER THE SECOND NUMBER: ";


cin >>b;

cout <<"ENTER THE THIRD NUMBER: ";


cin >>c;

sum=a + b + c;
cout <<"answer all basic math: ";
cout << sum;
sum=a + b + c;

return 0;
}

PROGRAM OUTPUT

You might also like