0% found this document useful (0 votes)
104 views4 pages

Lab Report Table of Content

Uploaded by

mahambilal020
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)
104 views4 pages

Lab Report Table of Content

Uploaded by

mahambilal020
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/ 4

PROGRAMMING FUNDAMENTALS

LAB REPORT TABLE OF CONTENT


Lab No Description Page No
Lab. 1 Introduction to IDE
LAB TASK 1.1: Installation of Dev C++
LAB TASK 1.2: Write a C++ program to print your name, roll number and
class,section.
Lab 2 Understanding of datatypes variables and constants
LAB TASK 2.1: Determine size of different data types
LAB TASK 2.2: Practice of variable and constants
Lab 3 Types of Operator
LAB TASK 3.1: Write a program in which all the arithmetic operators are
used.
LAB TASK 3.2: Write a program in which all the comparison operators are
used.
Lab 4 Pseudocode and flowchart
LAB TASK 4.1: Write a pseudocode to determine a student’s final grade
and indicate whether it is passing or failing based on the 50% marks. The
final grade is calculated as the average of four marks.
LAB TASK 4.2: Write pseudocode that takes input of three random
numbers and writes them all in ascending order.
LAB TASK 4.3: Write a pseudocode that calculate the age of citizens and
separate young and old citizens
Lab 5 If-else statements
LAB TASK 5.1: Write a program to calculate grades of students.
LAB TASK 5.2: Write a program to check Even and odd Numbers.
LAB TASK 5.3: Write a program to check vowels and consonants
LAB TASK 5.4: Write a program that take three numbers as input from the
user and finds maximum umber among them.
LAB TASK 5.5: Write a program to count the number of currency notes of
5000,1000,100,50,20, and 10 in any given amount.
LAB TASK 5.6: Write a program to take consumed electricity unit as an
input and calculate total electricity bill according to the following
conditions:
If number of units are up to 100, the bill will be charged at the rate of Rs.
5 per unit. If number of units are up to 200, the bill will be charged at the
rate of Rs. 10 per unit. If number of units are above 200, the bill will be
charged at the rate of Rs. 20 per unit.
Lab 6 Switch Statements
LAB TASK 6.1: Write a program to develop a simple calculator. The
program should take inputs of two integers, select the operator (+, - ,*, /)
using switch statement and display the output after performing the
desired calculation.
Lab 7 Nested if-else statement
LAB TASK 7.1: Write a program to check username and password.
LAB TASK 7.2: Write a program to design ATM interface using nested if-
else statements to perform the following transactions. Initialize the

1
PROGRAMMING FUNDAMENTALS

balance with zero and perform the cash deposit and withdrawal
transactions accordingly. After each transaction, the program should ask
the user to perform any other transaction or not. Based on the user input
(y/n) the program either redirects to the main interface or exit.
 Press B to check account Balance
 Press D to cash Deposit
 Press W to cash Withdraw
Lab 8 Loops (while, do-while ,for)
LAB TASK 8.1: Write a program that displays number from 1 to 10 using
while loop.
LAB TASK 8.2: Write the program of Guess the number game.
LAB TASK 8.3: Write a program which asks user to enter a positive integer
and then calculate the factorial of that number.
LAB TASK 8.4: Write a program which works like a year calendar
LAB TASK 8.5: Write a program which takes username and password
three times if incorrect using loop.
Lab 9 Arrays
LAB TASK 9.1: Write a program which takes an array as an input from the
user and also calculate the sum and average of all the array elements.
LAB TASK 9.2: Write a program that takes an array as an input form the
user and then finds the maximum and minimum number of the array.
LAB TASK 9.3: Write a program which takes input from the user in a 2D
array and then display that array on screen.
Lab 10 Functions
LAB TASK 10.1: Write a program that inputs two numbers from the user
in the main function and passes them to different functions to calculate
addition, subtraction, multiplication and division of these numbers.
LAB TASK 10.2: Write a program that takes array as an input using a
function named InputArray () and display the elements of the array using
another function named DisplayArray().

Lab 11 Pointers
LAB TASK 11.1: Write a program to declare an integer variable and a
pointer to that integer. Assign a value to the integer variable and make
the pointer points to it. Print both the value and the address of the
integer variable using the pointer.
LAB TASK 11.2. Write a program that swaps the values of two integers
using pointers.

LAB TASK 11.1

#include <iostream>

using namespace std;

int main() {

2
PROGRAMMING FUNDAMENTALS

int num = 10;

int *ptr; // Declare a pointer

ptr = &num; // Assign the address of 'number' to the pointer

cout << "Value of number: " << num << endl;

cout << "Address of number: " << &num << endl;

cout << "Value of pointer (address of number): " << ptr << endl;

cout << "Dereferenced pointer (value at the address): " << *ptr << endl;

LAB TASK 11.2.

#include <iostream>
Using namespace std;
int main() {
// Declare two integers
int num1 = 5, num2 = 10;

cout << "Before swapping:" <<endl;


cout << "num1 = " << num1 <<endl;
cout << "num2 = " << num2 << endl;

// Declare pointers and swap values


int* ptr1 = &num1;
int* ptr2 = &num2;

// Swap values using pointers


int temp = *ptr1;
*ptr1 = *ptr2;

3
PROGRAMMING FUNDAMENTALS

*ptr2 = temp;

cout << "After swapping:" << endl;


cout << "num1 = " << num1 <<endl;
cout << "num2 = " << num2 <<endl;
}

You might also like