Lab Manual 2

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 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