fixed index

This commit is contained in:
left_adjoint 2024-03-06 15:52:54 -08:00
parent e9261771e3
commit c23e31d3d4
2 changed files with 7 additions and 2 deletions

View File

@ -52,3 +52,8 @@
+ Lecture (2/28/2024)
+ https://tildegit.org/left_adjoint/cs161AWinter2024/src/branch/main/mistake1.cpp talking about easy to make mistakes such as accidentally mixing up = and ==
+ https://tildegit.org/left_adjoint/cs161AWinter2024/src/branch/main/nestedfor.cpp nested for loops
+ Lecture (3/6/2024)
+ https://tildegit.org/left_adjoint/cs161AWinter2024/src/branch/main/palfor.cpp a simple version of palindrome finding for single words
+ https://tildegit.org/left_adjoint/cs161AWinter2024/src/branch/main/arrayofarrays.cpp an examples of how an array of strings would work, this example shows how to find the acrostic of a set of sentences (well, just individual words you can change the code to use getline to make it work with whole sentences)
+ https://tildegit.org/left_adjoint/cs161AWinter2024/src/branch/main/whileArray.cpp this is an example of how to traverse an array only *partially* with a while-loop rather than a for loop
+ https://tildegit.org/left_adjoint/cs161AWinter2024/src/branch/main/palWithSpaces.cpp an example of how to solve discussion for in a single while loop

View File

@ -20,7 +20,7 @@ int main(){
int sum = 0;
int j = 0;
while(arr[j] != 0 && j < 10){
while(j < 10 && arr[j] != 0){
sum = sum + arr[j];
cout << j << endl;
j++;
@ -28,4 +28,4 @@ int main(){
cout << "The sum was: " << sum << endl;
return 0;
}
}