1/5
These flashcards cover various programming issues related to loops and type conversions in C++, as addressed in the lecture.
Loop Enumeration Issue
In the first loop example, the index used was 'j' instead of 'i', and the loop should run while 'i < 7' instead of 'i < 6'.
Infinite Loop Problem
In the second loop, it was caused by 'j' not being modified within the loop, causing the condition 'j < 10' to remain true indefinitely.
Initialization Error
In the third loop, the variable 'i' was incorrectly initialized to 100. It should be initialized to 0 to allow 13 iterations.
Logical Condition Errors
In the fourth scenario, the & operator should be '&&', and the assignments 'a=2' and 'b=7' should be comparisons 'a==2' and 'b==7'.
Implicit Conversion in C++
When an int is declared for a decimal value, it automatically truncates the decimal part, resulting in an integer output.
Explicit Conversion in C++
To convert a variable to a different type explicitly, use 'static_cast