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

Lab Manual 2

This document contains a C++ lab manual with examples and solutions to programming exercises. The exercises include: 1. A program to print a pyramid pattern of the letter c. 2. A program to display name, father's name, department, city, and college on separate lines with a beep sound. 3. A program to print a file path string using escape sequences. The document provides the code solutions to each exercise question. It ends by thanking the reader.

Uploaded by

topology kamal
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)
39 views

Lab Manual 2

This document contains a C++ lab manual with examples and solutions to programming exercises. The exercises include: 1. A program to print a pyramid pattern of the letter c. 2. A program to display name, father's name, department, city, and college on separate lines with a beep sound. 3. A program to print a file path string using escape sequences. The document provides the code solutions to each exercise question. It ends by thanking the reader.

Uploaded by

topology kamal
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

LAB MANUAL 2

C++

SUBMITTED TO : MS. FATIMA SHEHZADI


SUBMITTED BY : SYED ASIF SHAH
Reg no: 2020-CIV-330
Q1: Write a program to print this structure:
c
cc
ccc
cccc
ccccc

Solution:
#include<iostream>
using namespace std;
int main()
{

cout << "c"<<endl;

cout<<"cc"<<endl;

cout<<"ccc"<<endl;

cout<<"cccc"<<endl;

cout<<"ccccc"<<endl;

return 0;

Q2: Display the following information each on new line


and terminates with a beep sound.
1. Your Name
2. Father Name
3. Department Name
4. City Name
5. College Name

Solution:
#include<iostream>
using namespace std;

int main()

cout << "Syed asif shah"<<"\a\a\a"<<endl;

cout<<" Said kamal shah"<<"\a\a\a"<<endl;

cout<<"Civil Engineering department"<<"\a\a\a"<<endl;

cout<<"Buner"<<"\a\a\a"<<endl;

cout<<"Islamia college Peshawar"<<"\a\a\a"<<endl;


system("pause")
return 0;

Q3: Print out following using cout and escape sequences.

“C:\ProgramFiles\EASports\NFSUnderground”

Solution:
#include<iostream>
using namespace std;

int main()

cout << "C"<<"\a\a"<<"\\"<<endl;

cout<<"programFiles"<<"\t"<<endl;

cout<<"EASports"<<"\a\a\a"<<"\t"<<endl;

cout<<"NFSUnderground"<<"\r"<<endl;

system("pause")
return 0;
}

THANK YOU

You might also like