Académique Documents
Professionnel Documents
Culture Documents
Enrollment #: __________________________________
Date: __________________________________
Objective:
1) Practicing Simple Program
2) Practicing how to Write a Program
Tools Required:
int main() {
cout << "Newline character:"<<" \n"<<" ending" <<
endl; // Newline character
cout << "Tab character:"<<" \t "<<"ending" << endl; //
Tab character
cout << "Backspace character:"<<" \b"<<" ending" <<
endl; // Backspace character
cout << "Backslash character:"<<" \\ "<<"ending" <<
endl; // Backslash character
cout << "Null character:"<<" \0 "<<"ending" << endl;
//Null character
system("pause");
return 0; }
#include<iostream>
#include<conio.h>
using namespace std;
void main()
{
cout << "***************" << endl;
cout << "| |" << endl;
cout << "| |" << endl;
cout << "| |" << endl;
cout << "***************" << endl;
getch();
}
2. #include<iostream>
#include<conio.h>
using namespace std;
void main()
{
cout << "Manahil Imran" << endl;
cout << "01-134162-019" << endl;
cout << "1.86" << endl;
_getch();
}
3. #include<iostream>
#include<conio.h>
using namespace std;
int main ()
{
int count = 10;
cout<< “count =“ <<count;
cout<< “count=”<< ++count;
cout<< “count=”<<count++;
cout<<“count=”<<count;
return 0;
}
Lab-Task
1. Input three integer values from keyboard into variables a, b and c and add them. Store
the result in another variable named as Result.
2. Assign the product of variables b and c to a as entered by the user.
3. What prints when each of the following c++ statement is executed? Assume x=2 and
y=3.
cout<<x;
cout<<x+x;
cout<<“x=“;
cout<<“x=“<<x;
cout<<x+y<<“=“<<y+x;
4. Write a program that calculates the square of a number entered by the user and
displays output as below.
Value Square
4 12
* * *
*** *** ***
***** ***** *****
******* ******* *******
********* ********* *********
Attempt all tasks and get them checked by your instructor. If you are unable to complete a
task in lab then submit a hardcopy of the task alongwith the journal in the next lab.