You are on page 1of 11

Compilation

of
Case Studies

Name: Zander A. Licay


Course / Year: BSIT II-A
Subject: Data Structure and Algorithm
Instructor: Evelyn G. Naño
Case Study # 01
Output:

Source Code:
#include<iostream>
using namespace std;
int main()
{
int Z,L,temp;
cout<<"Enter Value of Z and L:";
cin>>Z>>L;
cout<<"Before Swapping."<<endl;
cout<<"Z="<<Z<<",L="<<L<<endl;
temp=Z;
Z=L;
L=temp;
cout<<"After Swapping."<<endl;
cout<<"Z="<<Z<<",L="<<L<<endl;
return 0;
}
Case Study # 06
Output:

Source Code:
#include<iostream>
using namespace std;
main()
{
int Z,A,L,P;
cout<<"w: ";
cin>>Z;
cout<<"x: ";
cin>>A;
cout<<"y: ";
cin>>L;
cout<<"z: ";
cin>>P;
cout<<"\n\nw: "<<A<<endl;
cout<<"x: "<<L<<endl;
cout<<"y: "<<P<<endl;
cout<<"z: "<<Z<<endl;
return 0;
}
Case Study #05
Output:

Source Code:
#include<iostream>
using namespace std;
main()
{
int Z,A,L;
cout<<"Enter Salary: P";
cin>>Z;

A=1175;
L=Z+A;

cout<<"Amount of Retroactive Pay: P"<<A<<endl;


cout<<"Total Salary is: P"<<L<<endl;
return 0;
}
Case Study #09
Output:

Source Code:
#include<iostream>
using namespace std;
int main()
{
int Z,A,L=1,P=2,next;
L=1;
P=2;
cout<<"Enter Number of Terms Series:";
cin>>A;
cout<<"Series are:"<<endl;
for(Z=0; Z<A; Z++)
{
cout<<endl<<L;
next=L+P;
L=P;
P=next;
}
return 0;
}
Case Study # 22
Output:

Source Code:
#include<iostream>
using namespace std;
int main()
{
int z=12;
for(int a=1;a<=z;a++)
{
cout<<""<<(a*a)<<endl;
}
return 0;
}
Case Study # 33
Output:

Source Code:
#include<iostream>
using namespace std;
int main()
{
int G;
cout<<"Enter Grade:"<<endl;
cin>>G;
if(G>=90&&G<=100)
{
cout<<"Excellent"<<endl;
}
else if(G>=80&&G<=89)
{
cout<<"Satisfactory"<<endl;
}
else if(G>=75&&G<=79)
{
cout<<"Good"<<endl;
}
else if(G<74)
{
cout<<"Failed"<<endl;
}
else
{
cout<<"Invalid!"<<endl;
}
return 0;
}
Case Study #36
Output:

Source Code:
#include<iostream>
using namespace std;
int main()
{
int Score1,Score2,Score3,Score4,Score5;
float Total,Average,Percentage;
cout<<"Enter First Score:";
cin>>Score1;
cout<<"Enter Second Score:";
cin>>Score2;
cout<<"Enter Third Score:";
cin>>Score3;
cout<<"Enter Forth Score:";
cin>>Score4;
cout<<"Enter Fifth Score:";
cin>>Score5;
Total=Score1+Score2+Score3+Score4+Score5;
Average=Total/5 ;
Percentage=Average/Total*100;
cout<<"The Total is:"<<Total<<endl;
cout<<"The Average is:"<<Average<<endl;
cout<<"The Percentage is:"<<Percentage<<endl;
return 0;
}
Case Study #40
Output:

Source Code:
#include<iostream>
using namespace std;
int main()
{
int Z,A,L;
cout<<"Enter The number of Rows:";
cin>>L;
for(Z=L;Z>=1;Z--)
{
for(A=1;A<=Z;A++)
{
cout<<"*";
}
cout<<endl;
}
return 0;
}
Case Study #44
Output:

Source Code:
#include <iostream>
using namespace std;
int main()
{
int No;
cout<<"Enter a positive integer:"<<endl;
cin>>No;

for (int Z=1;Z<=10;++Z)


{
cout<<No<<"*"<<Z<<"="<<No*Z<<endl;
}
return 0;
}
Case Study # 02
Output:

Source Code:
#include<iostream>
using namespace std;
int main()
{
int z;
for(z=1;z<=10;z++)
{
cout<<"Zander A. Licay"<<endl;
}
cout<<"\n"<<endl;
for(z=1;z<=10;z++)
{
cout<<"Zander A. Licay"<<endl;
}
cout<<"\n"<<endl;
for(z=1;z<=10;z++)
{
cout<<"Zander A. Licay"<<endl;
}
return 0;
}

You might also like