/* this file contains a number of sample functions and other techniques concerning arrays, loops, and strings */ #include #include // Function to print contents of integer array, with elements separated by // spaces and a carriage return at the very end: void printarray(int A[], int size) { int i; // loop counter, to go through array for(i=0;i 90) answer = false; // non-upper case char found! i++; } // end while return answer; } // capitals int main() { int A[5] = {1,7,9,5,3}; double B[3] = {1.2,3.4,5.6}; string S; S = "hello"; printarray(A,5); cout << sum(B,5) << " " << max(A,5) << " " << Indexmax(A,5) << endl; if (inarray(4,A,5)) cout << "4 is in A\n"; else cout << "4 is not in A\n"; cout << reverse(S) << endl; cout << capitals(S) << endl; // prints 1 for true, 0 for false return 0; }