You are on page 1of 7

ASSIGNMENT # 1

SUBMITTED TO
MR. TALAL BIN AFZAL

SUBMITTED BY
ANAS
JAHANGIR

1
BSSE-1 (MORNING)
SECTION: B

TASK.1

Declare the header files. then define the main function.


then use the cout statement to print the required message

#include <iostream>

#include <stdio.h> //header file.declaration of standard input,output


functions in C++

using namespace std;

int main()

{cout<<"Hello.How are you";

return 0;

2
TASK.2
Write A Program To Assign Values To Different Variables
(Atleast One Value For Each Variable Type).At The Time
Of Declaration. Print The Assigned Values On The
Computer Screen.
#include <iostream>

using namespace std;

int main ()

int num = 9; // Integer

float decimal = 89.76; // Floating point number

double decimal2 = 186.99; // Floating point number

char alphabet ='o'; // Character

string message = "Hello! how are you"; // String

cout << "int: " <<num<<endl;

cout << "float: " <<decimal<<endl;

cout << "double: " <<decimal2<<endl;

cout << "char: " <<alphabet<<endl;

cout << "string: " <<message<<endl;

return 0; }

3
TASK.3
Write a program to perform arithematic operation by using
all arthematic operators. Also print result on the screen.
#include <iostream>

using namespace std;

int main()

int a=90; //assingement operators

int b=60; //assingement operators

int c=40; //assingement operators

int d=20; //assingement operators

float e,f,g,h,k,l,m,n,o,p,i,j;

e=a+b;

f=a-b;

4
g=a*b;

h=b/d;

l=b+=d;

m=a-=c;

n=b/=c;

o=a*=c;

k=c%d;

p=a%=c;

i=++a;

j=--b;

cout<<"addition: "<<e<<endl;

cout<<"subtraction: "<<f<<endl;

cout<<"multiplication: "<<g<<endl;

cout<<"division: "<<h<<endl;

cout<<"assingement operators1: "<<l<<endl ;

cout<<"assingement operators2: "<<m<<endl;

cout<<"assingement operators3: "<<n<<endl;

cout<<"assingement operators4: "<<o<<endl;

cout<<"percentage: "<<k<<endl;

cout<<"assingement operators5: "<<p<<endl;

cout<<"increment"<<i<<endl;

cout<<"decrement"<<j;
5
return 0;

6
TASK. 4
Write a program that calculate area and circumference of
circle(using pi as a floating constant) with the output
formatted in the following way
#include <iostream>

using namespace std;

#define pi 3.14

int main()

{float

area,circum,radius;

cout<<"radius is";

cin>>radius;

area=pi*radius*radius;

circum=2*pi*radius;

cout<<"area is"<<area<<"\ncircumference is"<<circum;

return 0;

You might also like