# 17.2 Practice 17: conditional operator and recursion

 Page 1 / 1
Questions, exercises, problems, etc. that support this chapter in the "Programming Fundamentals - A Modular Structured Approach using C++" collection/textbook.

## Learning objectives

With 100% accuracy during a: memory building activity, exercises, lab assignment, problems, or timed quiz/exam; the student is expected to:

1. Define the terms on the definitions as listed in the modules associated with this chapter.
2. Understand the conditional operator and how it works.
3. Understand recursion as a problem solving technique.
4. When feasible, be able to convert C++ source code from a conditional expression to an if then else and vice versa.

## Answer the following statements as either true or false:

1. The conditional expression acts like a case structure.
2. The conditional operator is a two part operator with three operands.
3. Recursion is one method of implementing a repetitive algorithm.
4. Recursion is always preferred over an iterative approach to a repetitive problem.
5. Factorial is usually demonstrated with an iterative approach.

1. false
2. true
3. true
4. false
5. false

## Miscellaneous items

None at this time.

## Creating a folder or sub-folder for chapter 17 files

Depending on your compiler/IDE, you should decide where to download and store source code files for processing. Prudence dictates that you create these folders as needed prior to downloading source code files. A suggested sub-folder for the Bloodshed Dev-C++ 5 compiler/IDE might be named:

• Chapter_17 within the folder named: Cpp_Source_Code_Files

If you have not done so, please create the folder(s) and/or sub-folder(s) as appropriate.

Download and store the following file(s) to your storage device in the appropriate folder(s). You may need to right click on the link and select "Save Target As" in order to download the file.

## Detailed lab instructions

Read and follow the directions below carefully, and perform the steps in the order listed.

• Compile and run the Lab_17a.cpp source code file. Understand how it works.
• Copy the source code file Lab_17a.cpp naming it: Lab_17b.cpp
• Convert the code that is using the if then else to a conditional expression.
• Convert the code that is using the conditional expression to an if then else.
• Build (compile and run) your program.
• After you have successfully written this program, if you are taking this course for college credit, follow the instructions from your professor/instructor for submitting it for grading.

## Problem 17a – instructions

Using proper C++ syntax, convert the following if then else to a conditional expression.

## If then else

```if (x == y) {z = 14; }else {z++; }```

## Problem 17b – instructions

Using proper C++ syntax, convert the following conditional expression to an if then else.

## Conditional

`answer = y<z ? 47 : 92;`

are nano particles real
yeah
Joseph
Hello, if I study Physics teacher in bachelor, can I study Nanotechnology in master?
no can't
Lohitha
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
has a lot of application modern world
Kamaluddeen
yes
narayan
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
Got questions? Join the online conversation and get instant answers!