# 1.3 Labworks  (Page 5/11)

 Page 5 / 11

2.4) Write a C++ function that checks if a square matrix with order of n is symmetric or not. And then write a C++ program that inputs a square matrix with order of n and then checks if it is symmetric or not.

2.5) A palindrome is a string that reads the same both forward and backward. Some examples are

Given the following function that returns true if the parameter string is a palindrome or false , otherwise.

`bool palindrome(char strg[])`

`{`

`int len, k, j;`

`len = strlen(strg);`

`k = len/2;`

`j = 0;`

`bool palin = true;`

`while ( j<k&&palin)`

`if (strg[j] != strg[len -1-j])`

`palin = false;`

`else`

`++ j;`

`return (palin)`

`}`

Write a C++ program that reads several strings, one at a time and checks if each string is a palindrome or not. Use a while loop in your program. The loop terminates when the user enters a string starting with a ‘*’.

2.6) Write a boolean function that can checks if all the elements in integer array are unique (i.e. we can not find any pair of elements that are equal to each other).

Write a C++ program that inputs an integer array and invokes the function to check if all the elements in integer array are unique.

2.7) Given the following formula for computing the number of combinations of m things out of n, denote C(n, m).

C(n, m) = 1 if m = 0 or m=n

C(n, m) = C(n-1, m) + C(n-1, m-1) if 0<m<n

1. Write a recursive function to compute C(n,m).
2. Write a complete C++ program that reads two integers N and M and invokes the function to compute C(N,M) and prints the result out.

2.8) The greatest common divisor of two positive integers is the largest integer that is a divisor of both of them. For example, 3 is the greatest common divisor of 6 and 15, and 1 is the greatest common divisor of 15 and 22. Here is a recursive function that computes the greatest common divisor of two positive integers:

`int gcd(int p, int q)`

`{`

`int r ;`

`if (( r = p%q == 0)`

`return q ;`

`else`

`return gcd(q, r) ;`

`}`

a. First write a C++ program to test the function.

b. Write and test an equivalent iterative function.

## 1. objective

The objectives of Lab session 7 are to get familiar with how to use pointers in C++.

## 2. experiment

2.1) Run the following program to determine the size of two data types long and byte.

`# include<iostream.h>`

`void main()`

`{`

`byte* a;`

`long* b;`

`cout<<sizeof(a)<<endl;`

`cout<<sizeof(b)<<endl;`

`}`

2.2) Given the following code segment:

`float pay;`

`float *ptr_pay;`

`pay=2313.54;`

`ptr_pay =&pay;`

determine the values of the following expressions:

a. pay

b. *ptr_pay

c. *pay

d.&pay

2.3) Read for understanding the following program:

`#include<iostream.h>`

`void main()`

`{`

`int a;`

`int *aPtr; // aPtr is a pointer to an integer`

`a = 7;`

`aPtr =&a; //aPtr set to address of a`

`cout<<“The address of a is “<<&a`

`<<“\nThe value of aPtr is “<<aPtr;`

`cout<<“\n\nThe value of a is “<<a`

`<<“\nThe value of *aPtr is “<<*aPtr`

`<<endl;`

`}`

Run the program and explain the output.

2.4) Given the following array and pointer declarations:

`int ara[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};`

`int *ip1, *ip2;`

Determine which of the following assignments are valid.

a. ip1 = ara;

b. ip2 = ip1 =&ara;

where we get a research paper on Nano chemistry....?
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
Preparation and Applications of Nanomaterial for Drug Delivery
revolt
da
Application of nanotechnology in medicine
what is variations in raman spectra for nanomaterials
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! By OpenStax By By OpenStax By OpenStax By OpenStax By Madison Christian By By OpenStax By Janet Forrester By David Bourgeois