diff --git a/2.cpp b/2.cpp index 6a27746..27e7885 100644 --- a/2.cpp +++ b/2.cpp @@ -5,11 +5,11 @@ using namespace std; // count all the specific char in the whole array of strings int countAllSpecificChars(string sArr[], int arrLength, char specificChar) { - int count; - for (int i = 0; i <= arrLength; ++i) - for (int j = 0; j <= sArr[i].size(); ++j) + int count = 0; //variable count wasnt initialized + for (int i = 0; i < arrLength; i++)//"<="changed to "<" + for (int j = 0; j < sArr[i].size(); j++)//"<="changed to "<" // if the jth char of the string is the specific char - if (sArr[i][j] = specificChar) + if (sArr[i][j] == specificChar)//"="changed to "==" count++; return count; } diff --git a/4.cpp b/4.cpp index a9a32f2..c377c62 100644 --- a/4.cpp +++ b/4.cpp @@ -2,8 +2,10 @@ int main() { float arr[5] = { 12.5, 10.0, 13.5, 90.5, 0.5 }; - float *ptr1 = &arr[0]; - float *ptr2 = ptr1 + 3; + float* ptr1 = &arr[0]; + float* ptr2 = ptr1 + 3; printf("%f", *ptr2 - *ptr1); return 0; -} \ No newline at end of file +} +//no problem +//78 \ No newline at end of file diff --git a/5.cpp b/5.cpp index e9a1737..b651b83 100644 --- a/5.cpp +++ b/5.cpp @@ -2,9 +2,11 @@ int main() { int arr[] = { 10, 20, 30, 40, 50, 60 }; - int *ptr1 = arr; - int *ptr2 = arr + 5; + int* ptr1 = arr; + int* ptr2 = arr + 5; printf("%d\n", (*ptr2 - *ptr1)); printf("%c", (char)(*ptr2 - *ptr1)); return 0; -} \ No newline at end of file +} +//50 +//2 \ No newline at end of file diff --git a/6.cpp b/6.cpp index bb721c3..ca2df93 100644 --- a/6.cpp +++ b/6.cpp @@ -9,3 +9,4 @@ int main() printf("%d\n", a); return 0; } +//513 diff --git a/7.cpp b/7.cpp index 7b065a0..2da73b3 100644 --- a/7.cpp +++ b/7.cpp @@ -7,4 +7,5 @@ int main() p += 2; printf("%d", *p); return 0; -} \ No newline at end of file +} +//3 \ No newline at end of file diff --git a/8.cpp b/8.cpp index 76b870c..35cfd03 100644 --- a/8.cpp +++ b/8.cpp @@ -11,3 +11,4 @@ int main() { } +//Be WooW \ No newline at end of file