Home
Site Map
Useful Tools
Graphing Calc

Scientific Calculator

Arrays in C++

Arrays in C++ at www.cplusplus.com
void printReverse(int nums[], int len)
Description: This function takes an array nums and its length and prints the array in reverse order.
Method Call return value/output
printReverse({2,3,4} ,3 ) 2
3
4
printReverse({3 , 4 } 2 } 2
3
double mean(int nums[], int len)
Description: This function calculates the arithmetic mean of the array nums.
Method Call return value/output
mean({2,3,4} ,3 ) 3
mean({3 , 4 } 2 } 3.5
int largest(int nums[], int len)
Description: This function returns the largest value of the array.
Method Call return value/output
largest({2,3,4} , 3) 4
largest({ 5, 12, 3, 7, 4 }, 5 } 12
largest( { -2, -3, -4} , 3) -2
int[] doubleAnArr(int nums[], int len)
Description: This function returns an array that has two copies of the original array..
Method Call return value/output
doubleAnArr({2,3,4} ) {2 , 3, 4 , 2 , 3 , 4 }
doubleAnArr({,6, 11} } { 6 , 11 , 6 , 11}
void printSum(int num1[], int num2[], int length)
Description: Assume that each element in num1 and num2 are digits in a number. Also assume that both eleements have length digits. Store the resulting sum into a new array that you will then print out. If the result of the addition is more than length long, then simply output the message "Addition Overflow" and nothing else . (We can't return the .
Method Call return value/output
printSum( {2,3,4} , {2,2,9} ) { 4, 6 , 3}
printSum( {9,3,4} , {2,2,9} ) "Additional Overflow"
Sitemap