#include <iostream>using std::cout;using std::endl;int main(){ const int arraySize = 20; float cheapest; float a[arraySize] = { 14.60, 15.50, 53.20, 44.80, 48.60, 12.65, 21.20, 32.50, 51.20, 17.50, 12.65, 14.60, 15.50, 53.20, 44.80, 48.60, 21.20, 32.50, 51.20, 17.50 }; cheapest = a[0]; for(int i = 1; i < arraySize; i++) { if(cheapest > a[i]) { cheapest = a[i]; } } cout << "Cheapest candy cost " << cheapest << "grn" << endl; return 0;}
#include <iostream>
using std::cout;
using std::endl;
int main()
{
const int arraySize = 20;
float cheapest;
float a[arraySize] = { 14.60, 15.50, 53.20, 44.80, 48.60, 12.65, 21.20, 32.50, 51.20, 17.50, 12.65, 14.60, 15.50, 53.20, 44.80, 48.60, 21.20, 32.50, 51.20, 17.50 };
cheapest = a[0];
for(int i = 1; i < arraySize; i++)
{
if(cheapest > a[i])
{
cheapest = a[i];
}
}
cout << "Cheapest candy cost " << cheapest << "grn" << endl;
return 0;
}