# 1.3 Labworks

 Page 1 / 11

Lab Session 1:

Introduction to C++

Lab Session 2:

Selection Structures

Lab Session 3:

Repetition Structures

Lab Session 4:

Arrays

Lab Session 5:

Structures

Lab Session 6:

Functions

Lab Session 7:

Pointers

Lab Session 8:

Introduction to Classes

Lab Session 9:

Object Manipulation

Lab Session 10:

Inheritance

Programming Project Topic Examples

## 1. objective

The objectives of Lab 1 are (1) to known how to run a simple C++ program; (2) to know the basic data types and operators; (3) to learn how to use variable declarations and assignment statements.

## 2. experiment

2.1) Test the following program:

`#include<iostream.h>`

`int main()`

`{`

`const float PI=3.14159;`

`float radius = 5;`

`float area;`

`area = radius * radius * PI; // Circle area calculation`

`cout<<“The area is “<<area<<“ with a radius of 5.\n”;`

`radius = 20; // Compute area with new radius.`

`area = radius * radius * PI;`

`cout<<“The area is “<<area<<“ with a radius of 20.\n”;`

`return 0;`

`}`

1. Run the above program
2. Use #define to define the constant PI
3. Declare the constant PI in the file “mydef.h”, and then use the #include directive to insert the header file in the above program.

2.2) Debug the following code segment.

`#include<iostream.h>`

`int main()`

`{`

`const int age=35;`

`cout<<age<<“\n”;`

`age = 52;`

`cout<<age<<“\n”;`

`return 0;`

`}`

2.3) What is the result of each following expression:

1. 1 + 2 * 4 / 2
2. (1 + 2) * 4 / 2
3. 1 + 2 * (4 / 2)
4. 9 % 2 + 1
5. (1 + (10 - (2 + 2)))

2.4) Run the following programs and explain their results.

a.

`void main()`

`{`

`short i = -3;`

`unsigned short u;`

`cout<<sizeof(i)<<&i;`

`cout<<sizeof(u)<<&u;`

`cout<<(u = i)<<"\n";`

`}`

b.

`void main()`

`{`

`byte i = 125*4/10;`

`cout<<i<<"\n";`

`}`

2.5) Write a program that inputs two time points and display the difference between them.

2.6) Run the following programs and explain their results:

a.

`#include<iostream.h>`

`int main()`

`{`

`int f, g;`

`g = 5;`

`f = 8;`

`if ((g = 25) || (f = 35))`

`cout<<“g is “<<g<<“ and f got changed to “<<f;`

`return 0;`

`}`

b.

`#include<iostream.h>`

`void main()`

`{`

`if (!0)`

`{ cout<<“C++ By Example \n”; }`

`int a = 0;`

`if ( a !=0&&2/a>0 )`

`cout<<“hello”;`

`}`

2.7) Write a program that inputs the three grades for mathematics, physics and chemistry. And then it displays the average of the three grades in the following format:

## 1. objective

The objective of Lab 2 is to practice C++’s selection structures, such as:

• if
• if … else
• switch

## 2. experiment

2.1) Run the following program:

`// BEEP : ‘\x07’`

`#include<iostream.h>`

`#define BEEP cout<<“\a \n”`

`int main()`

`{`

`int num;`

`cout<<“Please enter a number “;`

`cin>>num;`

`if (num == 1)`

`{ BEEP; }`

`else if (num == 2)`

`{ BEEP; BEEP; }`

`else if (num == 3)`

`{ BEEP; BEEP; BEEP; }`

`else if (num == 4)`

`{ BEEP; BEEP; BEEP; BEEP; }`

`else if (num == 5)`

`{ BEEP; BEEP; BEEP; BEEP; BEEP; }`

`return 0;`

`}`

2.2) Run the following program:

`#include<iostream.h>`

`#define BEEP cout<<“\a \n”`

`int main()`

`{`

`int num;`

`cout<<“Please enter a number “;`

`cin>>num;`

`switch (num)`

`{`

`case (1): { BEEP;`

`break; }`

`case (2): { BEEP; BEEP;`

`break; }`

`case (3): { BEEP; BEEP; BEEP;`

`break; }`

`case (4): { BEEP; BEEP; BEEP; BEEP;`

`break; }`

`case (5): { BEEP; BEEP; BEEP; BEEP; BEEP;`

where we get a research paper on Nano chemistry....?
nanopartical of organic/inorganic / physical chemistry , pdf / thesis / review
Ali
what are the products of Nano chemistry?
There are lots of products of nano chemistry... Like nano coatings.....carbon fiber.. And lots of others..
learn
Even nanotechnology is pretty much all about chemistry... Its the chemistry on quantum or atomic level
learn
da
no nanotechnology is also a part of physics and maths it requires angle formulas and some pressure regarding concepts
Bhagvanji
hey
Giriraj
Preparation and Applications of Nanomaterial for Drug Delivery
revolt
da
Application of nanotechnology in medicine
what is variations in raman spectra for nanomaterials
ya I also want to know the raman spectra
Bhagvanji
I only see partial conversation and what's the question here!
what about nanotechnology for water purification
please someone correct me if I'm wrong but I think one can use nanoparticles, specially silver nanoparticles for water treatment.
Damian
yes that's correct
Professor
I think
Professor
Nasa has use it in the 60's, copper as water purification in the moon travel.
Alexandre
nanocopper obvius
Alexandre
what is the stm
is there industrial application of fullrenes. What is the method to prepare fullrene on large scale.?
Rafiq
industrial application...? mmm I think on the medical side as drug carrier, but you should go deeper on your research, I may be wrong
Damian
How we are making nano material?
what is a peer
What is meant by 'nano scale'?
What is STMs full form?
LITNING
scanning tunneling microscope
Sahil
how nano science is used for hydrophobicity
Santosh
Do u think that Graphene and Fullrene fiber can be used to make Air Plane body structure the lightest and strongest. Rafiq
Rafiq
what is differents between GO and RGO?
Mahi
what is simplest way to understand the applications of nano robots used to detect the cancer affected cell of human body.? How this robot is carried to required site of body cell.? what will be the carrier material and how can be detected that correct delivery of drug is done Rafiq
Rafiq
if virus is killing to make ARTIFICIAL DNA OF GRAPHENE FOR KILLED THE VIRUS .THIS IS OUR ASSUMPTION
Anam
analytical skills graphene is prepared to kill any type viruses .
Anam
Any one who tell me about Preparation and application of Nanomaterial for drug Delivery
Hafiz
what is Nano technology ?
write examples of Nano molecule?
Bob
The nanotechnology is as new science, to scale nanometric
brayan
nanotechnology is the study, desing, synthesis, manipulation and application of materials and functional systems through control of matter at nanoscale
Damian
Is there any normative that regulates the use of silver nanoparticles?
what king of growth are you checking .?
Renato
What fields keep nano created devices from performing or assimulating ? Magnetic fields ? Are do they assimilate ?
why we need to study biomolecules, molecular biology in nanotechnology?
?
Kyle
yes I'm doing my masters in nanotechnology, we are being studying all these domains as well..
why?
what school?
Kyle
biomolecules are e building blocks of every organics and inorganic materials.
Joe
how did you get the value of 2000N.What calculations are needed to arrive at it
Privacy Information Security Software Version 1.1a
Good
Got questions? Join the online conversation and get instant answers!