lab 1
lab 1
ENGINEERING
COLLEGE OF E&ME, NUST, RAWALPINDI
LAB REPORT – 01
GROUP MEMBERS:
Fatima Hasnain
Areesha Khan
Abdul Ahad
ME-46-A
LAB TASK 1:
Write a C++ program that displays the text/string "Welcome to the Department of Mechanical
Engineering" on the console. Make sure to include comments for each line of the code to
explain what it does. Ensure your program is properly formatted and runs without errors.
CODE:
cout << "Welcome to The Department of Mechanical Engineering" << endl; // printing Message
}
LAB TASK 2:
Write a C++ program that displays the following personal details:
Name
CMS ID
Syndicate
Degree
Take user input for each detail. Make sure to include comments for each line of the code
to explain what it does.
#include <iostream> //Including input/output library
#include<string> //Including input/output library
using namespace std; // use the standard name space
LAB TASK 3:
Write a C++ program that calculates and displays the sum of the first
and last digits of your ticket number. For example, if your age is 19
and your birth year is 2005, your ticket number will be 192005, the
first digit is 1 and the last digit is 5, and the program should display
their sum, which is 6. You are required to initialize the first and last
digits with predefined values based on your ticket number.
LAB TASK 4:
Rewrite the C++ program from Task 3, but this time, use cin to take the first
and last digits of your ticket number as input from the user. Once the user
enters these digits, the program should calculate the sum of the first and last
digits and display the result.