Lab No1
Lab No1
1
Introduction to C++ programming
Objective :
In this lab software introduction has been discussed along with basic writing of the
program inside the compiler and its steps.
Tools:
Dev C++
Background Knowledge:
Dev C++ is an Integrated Development Environment (IDE) for C and C++
programming language. With this environment you can edit, build, run, and debug
your program freely. You can write Windows or console-based C/C++ programs
easily.
C++ is a statically typed, free-form, (usually) compiled, multi-paradigm,
intermediate-level general-purpose middle-level programming language. Many of
today’s operating systems, system drivers, browsers and games use C++ as their core
language. This makes C++ and its software like C Fee and DEV C++ an excellent
choice. Since it is an enhanced/extended version of C programming language, C and
C++ are often denoted together as C/C++.
Sample Tasks
Task 1
Write a program to print your name on the output screen
#include <iostream>
using namespace std;
int main( )
{
cout<<"rayan ullah "<<endl;
}
1
Task 2
Write a program to calculate the sum of any two numbers on the output screen
#include
<iostream>
using namespace std;
int main( )
{
int a,b,sum;
a=2;
b=3;
sum=a+b;
cout<<"Sum ="<<sum<<endl;
}
Task 3
Write a program to multiply any two numbers and print the result on the output
screen
#include
<iostream>
using namespace std;
int main( )
{
int a,b,mul;
a=2;
mul=a*b;
cout<<"Multiply
="<<mul<<endl; return 0;
2
}
Exercise :
Exercise 1:
Write down the syntax for declaration of variable
Solution:
#include<iostream>
Int main;(){
String name;
Name="rayan ullah";
Return 0;
Instructor Signatures:
Remarks:
Exercise 2
Write a proggram which displays your Bio data on the output screen.
Solution:
3
#include<iostream>
Int main;(){
Cout<<"name:rayan ullah"<<endl;
Cout<<"sap id :70174891">>endl;
Cout<<"program:bsiet"<<endl;
Cout<<"sec:j"<<endl;
Return 0;
4
Marks Obtained Total Marks
Instructor Signatures:
Remarks:
Exercise 3
Write a program to add and multiply any three variables a, b, c and print
the result on the output screen
Solution:
#include<iostream>
using namespace std;
int main(){
int a,b,c,multiply;
a=6;
b=6;
c=6;
multiply=a*b*c;
cout<<"multiply="<<multiply<<endl;
return 0;
Instructor Signatures:
Remarks:
5
FINAL EVALUTION LAB 01
Student Name:
Registration Number:
Date:
Instructor Signatures:
Remarks: