0% found this document useful (0 votes)
7 views6 pages

lab 1

The document is a lab report for a Computer Systems & Programming course detailing four lab tasks. Each task involves writing C++ programs with specific functionalities, including displaying messages, taking user input for personal details, and calculating the sum of digits from a ticket number. The report includes code snippets with comments explaining each line to ensure clarity and understanding.

Uploaded by

fatimahasnain410
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)
7 views6 pages

lab 1

The document is a lab report for a Computer Systems & Programming course detailing four lab tasks. Each task involves writing C++ programs with specific functionalities, including displaying messages, taking user input for personal details, and calculating the sum of digits from a ticket number. The report includes code snippets with comments explaining each line to ensure clarity and understanding.

Uploaded by

fatimahasnain410
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/ 6

DEPARTMENT OF COMPUTER & SOFTWARE

ENGINEERING
COLLEGE OF E&ME, NUST, RAWALPINDI

EC-237 Computer Systems & Programming

LAB REPORT – 01

Course Instructor: Dr. Sagheer Khan

Lab Instructor: Engr. Eman Fatima

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:

#include <iostream> //Including input/output library

using namespace std; // use the standard name space

int main() // Main function, program starts here

cout << "Welcome to The Department of Mechanical Engineering" << endl; // printing Message

system("pause"); // pause program to keep window open

return 0; //Return 0 to indicate successful execution

}
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

int main() // Main function, program starts here


{
int CMSID, Degree; // whole number
char Syndicate; //a single letter
string Name; //a word on sentence

cout << "Enter the Name: ";


cin >> Name;
cout << "Enter the Syndicate: ";
cin >> Syndicate;
cout << "Enter the Degree: ";
cin >> Degree;
cout << "Enter the CMSID: ";
cin >> CMSID;
system("pause"); // pause program to keep window open
return 0; //Return 0 to indicate successful execution
}

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.

You might also like