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

Lab Report 2

The document contains a series of C++ lab tasks completed by Taha Jalil, including various programs that demonstrate output statements, personal introduction letters, and pyramid patterns. Each task includes the C++ code and the expected output. The tasks illustrate fundamental programming concepts and structured output formatting.

Uploaded by

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

Lab Report 2

The document contains a series of C++ lab tasks completed by Taha Jalil, including various programs that demonstrate output statements, personal introduction letters, and pyramid patterns. Each task includes the C++ code and the expected output. The tasks illustrate fundamental programming concepts and structured output formatting.

Uploaded by

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

Name : Taha Jalil

Rg ID : 240201010
Assignment : PF (Lab Report 2)

Lab Task 1 :
C++ Statement :
#include <iostream>

using namespace std;

int main() {

cout << "FirstName" << endl;

cout << "LastName" << endl;

return 0;

Output :
Lab Task 2 :
C++ Statement :
a#include <iostream>

using namespace std;

int main() {

cout << "Any intelligent fool, ";

cout << "can make things bigger, more complex, and more violent. ";

cout << "It takes a touch of genius -- and a lot of courage -- ";

cout << "to move in the opposite direction. ";

cout << "\"Albert Einstein\"";

return 0;

Output :
Lab Task 3 :
C++ Statement :
//LAB task 3

#include <iostream>

using namespace std;

// Start of the program

int main() {

// Displaying the first line

cout << "------- Computer Science is Fun ----" << endl;

// Displaying the second line

cout << " Fun is life." << endl;

// Displaying the third line

cout << " Life is precious." << endl;

// Displaying the last line

cout << "------- ------- ------- -------" << endl;

return 0; // End of program }


Lab Task 4 :
C++ Statement :
//Lab Task 2

//Lab Task 04:

//1. Write a C++ program to display letter in the following format Using

// simple cout << statement. use endl , \n , \t properly where applicable.

#include <iostream>

using namespace std;

int main() {

cout << "Personal Introduction Letter" << endl << endl;

cout << "From," << endl;

cout << "\tMr. Mathew Parker," << endl;

cout << "\tLocal Community Office," << endl;

cout << "\tYorkshire." << endl << endl;

cout << "To," << endl;

cout << "\tMr. Collins," << endl;

cout << "\tMayor," << endl;

cout << "\tYorkshire." << endl << endl;

cout << "Dear Mr. Collins," << endl << endl;

cout << "My name is Mathew Parker and I have been appointed as a worker in the local\n";

cout << "community office last week. I have been assigned the responsibility to look into\n";

cout << "the matters related to general health of the public as well as sought out the\n";

cout << "grievances of the people of the locality.\n";

cout << "Sir as you are the most honorable and responsible citizen in the area. So, I seek\n";
cout << "your permission to visit the local social offices and establishments at regular\n";

cout << "intervals so that I can ensure that these offices work properly and also look after\n";

cout << "the public hygiene. In order to keep the program going and bring about a change\n";

cout << "in the society I would require you support.\n";

cout << "I hope that you will duly accept my introduction keeping in mind the above context\n";

cout << "and I will receive your full support and attention to deliver my best for the benefit of\n";

cout << "the common people.\n";

cout << "Sincerely,\n";

cout << "Mr. Parker" << endl;

return 0;

Output :
Lab Task 5 :
C++ Statement :
//TASK 5

#include <iostream>

using namespace std;

int main() {

//Full Pyramid

cout << " * " << endl;

cout << " *** " << endl;

cout << " ***** " << endl;

cout << " ******* " << endl;

cout<<"\n";

//inverted Full pyramid

cout<<"\n";

cout << " ******* " << endl;

cout << " ***** " << endl;

cout << " *** " << endl;

cout << " * " << endl;

cout<<"\n";
//Hollow full pyramid

cout<<"\n";

cout << " * " << endl;

cout << " * * " << endl;

cout << " * * " << endl;

cout << " * * " << endl;

return 0;

Output :

You might also like