# 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;

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
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
anyone know any internet site where one can find nanotechnology papers?
research.net
kanaga
sciencedirect big data base
Ernesto
Introduction about quantum dots in nanotechnology
what does nano mean?
nano basically means 10^(-9). nanometer is a unit to measure length.
Bharti
do you think it's worthwhile in the long term to study the effects and possibilities of nanotechnology on viral treatment?
absolutely yes
Daniel
how to know photocatalytic properties of tio2 nanoparticles...what to do now
it is a goid question and i want to know the answer as well
Maciej
Abigail
for teaching engĺish at school how nano technology help us
Anassong
How can I make nanorobot?
Lily
Do somebody tell me a best nano engineering book for beginners?
there is no specific books for beginners but there is book called principle of nanotechnology
NANO
how can I make nanorobot?
Lily
what is fullerene does it is used to make bukky balls
are you nano engineer ?
s.
fullerene is a bucky ball aka Carbon 60 molecule. It was name by the architect Fuller. He design the geodesic dome. it resembles a soccer ball.
Tarell
what is the actual application of fullerenes nowadays?
Damian
That is a great question Damian. best way to answer that question is to Google it. there are hundreds of applications for buck minister fullerenes, from medical to aerospace. you can also find plenty of research papers that will give you great detail on the potential applications of fullerenes.
Tarell
what is the Synthesis, properties,and applications of carbon nano chemistry
Mostly, they use nano carbon for electronics and for materials to be strengthened.
Virgil
is Bucky paper clear?
CYNTHIA
carbon nanotubes has various application in fuel cells membrane, current research on cancer drug,and in electronics MEMS and NEMS etc
NANO
Got questions? Join the online conversation and get instant answers!   By     By By 