Lab Report Table of Content
Lab Report Table of Content
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.
#include <iostream>
int main() {
2
PROGRAMMING FUNDAMENTALS
cout << "Value of pointer (address of number): " << ptr << endl;
cout << "Dereferenced pointer (value at the address): " << *ptr << endl;
#include <iostream>
Using namespace std;
int main() {
// Declare two integers
int num1 = 5, num2 = 10;
3
PROGRAMMING FUNDAMENTALS
*ptr2 = temp;