Computers and Technology

Write a function PrintShampooInstructions(), with int parameter numCycles, and void return type. If numCycles is less than 1, print "Too few.". If more than 4, print "Too many.". Else, print "N: Lather and rinse." numCycles times, where N is the cycle number, followed by "Done.". End with a newline. Example output for numCycles = 2:
1: Lather and rinse.
2: Lather and rinse.
Done.

Hint: Define and use a loop variable.

So, this is what I have done.
#include
using namespace std;
void PrintShampooInstructions( int numCycles ) {
if (numCycles < 1) {
cout << "Too few." << endl ;
}
if (numCycles > 4 ) {
cout << "Too many." << endl ;
}
else {
int i = 0 ;
int N = 0 ;
for ( i = N ; i < numCycles ; ++i) {
cout << "i: Lather and rinse." << endl ;
cout << "Done." << endl ;
}
}
}
return ;
}
int main() {
PrintShampooInstructions(2);

return 0;
}

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 13:00, Racc
What converts chemical energy into rotational or linear motion?
Answers: 1
image
Computers and Technology, 22.06.2019 20:00, jc624826
What side length would you specify if you were required to create a regular hexagonal plate that was composed of 33 cm(squared) of sheet metal? dimension the side length to 0.1 cm
Answers: 2
image
Computers and Technology, 22.06.2019 21:00, daniella0123
Simon says is a memory game where "simon" outputs a sequence of 10 characters (r, g, b, y) and the user must repeat the sequence. create a for loop that compares the two strings starting from index 0. for each match, add one point to userscore. upon a mismatch, exit the loop using a break statement. assume simonpattern and userpattern are always the same length. ex: the following patterns yield a userscore of 4: simonpattern: rrgbryybgy userpattern: rrgbbrybgy
Answers: 2
image
Computers and Technology, 23.06.2019 02:30, hailey5campbelp7d1c0
What is the power dissipated by a resistor with a current of 0.02 a and a resistance of 1,000 ? a. 200 w b. 20 w c. 0.4 w d. 4 w
Answers: 1
Do you know the correct answer?
Write a function PrintShampooInstructions(), with int parameter numCycles, and void return type. If...

Questions in other subjects:

Konu
Mathematics, 04.03.2021 02:40
Konu
Mathematics, 04.03.2021 02:40
Konu
Mathematics, 04.03.2021 02:40
Konu
Mathematics, 04.03.2021 02:40