0% found this document useful (0 votes)
5 views

DSA-LAB_02 (One dimensional Array )

This document outlines a practical lab exercise focused on one-dimensional arrays in C++. It covers the objectives of declaring and manipulating arrays, as well as searching for items within them, and includes example programs and review questions for further practice. The lab aims to enhance understanding of array operations in C++ programming.

Uploaded by

fareedasoomro41
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

DSA-LAB_02 (One dimensional Array )

This document outlines a practical lab exercise focused on one-dimensional arrays in C++. It covers the objectives of declaring and manipulating arrays, as well as searching for items within them, and includes example programs and review questions for further practice. The lab aims to enhance understanding of array operations in C++ programming.

Uploaded by

fareedasoomro41
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Practical # 02

Objective:
Discuss one dimensional Array. Write C++ to declare and print elements of one dimensional
Array.

Theory:
In this Lab, we will introduce the array, a homogeneous data type also used to represent a
group of data. This data type might be used to store many items of the same type as a
conceptual unit. For example, all of the scores made on a test by students in a data structure
and algorithm class might be stored in an array, or the names of students are stored in an
array.

Lab Objectives:

 To be able to declare a one-dimensional array.


 To be able to perform fundamental operations on a one-dimensional array.
 To learn some common ways to search for an item in a one-dimensional array.

Introduction:

A one-dimensional array is a structured collection of components (often called array


elements) that can be accessed individually by specifying the position of a component with
a single index value. The syntax of a one-dimensional array declaration is:

Data_Type Array_Name [Int_Value];

Example program: Declare and print elements of one dimensional Array.


OUTPUT

Review Questions/ Exercise:

1. Write a C++ program to print largest value of array.


2. Write a C++ program to insert new ITEM at Top of the array. Print all elements of
the array.
3. Write a C++ program to insert new ITEM at Bottom of the array. Print all elements
of the array.
4. Write a C++ program to insert new ITEM at given location LOC. Print all elements of
the array.
5. Write a C++ program to deletes ITEM from Top of the array. Print all elements of the
array.
6. Write a C++ program to deletes ITEM from Bottom of the array. Print all elements of
the array.
7. Write a C++ program to add two integer arrays and print the output array.

Name: _____
Roll #: _____
Date: _____

Lab Teacher

You might also like