Exemplo n.º 1
0
int main(void)
{
	int cookies[ArSize]={1,2,4,8,16,32,64,128};

	std::cout<<cookies<<" = array address, ";

	std::cout<<sizeof cookies<<" = sizeof cookies\n";
	int sum=sum_arr(cookies,ArSize);
	std::cout<<"Total cookies eatn: "<<sum<<std::endl;
	sum=sum_arr(cookies,3);
	std::cout<<"First three eaters ate "<<sum<<" cookies.\n";
	sum=sum_arr(cookies+4,4);
	std::cout<<"Last four eaters ate "<<sum<<" cookies.\n";
	return 0;
}
Exemplo n.º 2
0
int main(void)
{
    int size, sum, product;
    int array[100];
    printf("size = ");
    scanf("%d", &size);
    array_in(array, size);
    sum = sum_arr(array, size);
    product = product_arr(array, min_element(array, size), max_element(array, size));
    printf("sum = %d \n", sum);
    printf("product = %d \n", product);
    return 0;
}