51.6k views
3 votes
The following code segment performs a simple encryption routine on string password. How many times does the following loop execute? What is the value of password after the for loop terminates?

string password = "notsecure";

for (int i = 0; i < password.length(); i++)

{

password.at(i) += 1;

}

1 Answer

7 votes

Answer:

9 times

password == "oputfdvsf"

Step-by-step explanation:

The loop executes as many times as there are characters in the string.

User Kannan Arumugam
by
8.3k points