hello,
why the output below produce number 0, eventhought there is no 0 in the array?
#include <iostream>
#include <conio.h>
#include <cstdlib>
#include <cmath>
#include <cstdio>
#include <ctime>
using namespace std;
int i;
int x[7];
int A[7], B[7], C[7], D[7], E[7], F[7];
int Min( const int *A, const int Count);
int minimum, minA, minB, flagB;
int main(void);
int count = 7;
{
for(i=1;i<7;i++)
{
x[i]=i;
A[i]=(2+pow(x[i],2));
B[i]=(1+pow(x[i],3));
C[i]=(2+pow(x[i],2)-1);
D[i]=(3*pow(x[i],3));
E[i]=(1+pow(x[i],2));
F[i]=(3+pow(x[i],2));
}
{
cout <<"\n";
for(i=1;i<7; i++)
{ printf("[%d][%d] A[%d]=%d\n", i,1, i, A[i]);
}
cout <<"\n";
for(i=1;i<7; i++)
{
printf("[%d][%d] B[%d]=%d\n", i,2, i, B[i]);
}
cout <<"\n";
for(i=1;i<7; i++)
{
printf("[%d][%d] C[%d]=%d\n", i,3, i, C[i]);
}
cout <<"\n";
for(i=1;i<7; i++)
{
printf("[%d][%d] D[%d]=%d\n", i,4, i, D[i]);
}
cout <<"\n";
for(i=1;i<7; i++)
{
printf("[%d][%d] E[%d]=%d\n", i,5, i, E[i]);
}
cout <<"\n";
for(i=1;i<7; i++)
{
printf("[%d][%d] F[%d]=%d\n", i,6, i, F[i]);
}
}
printf("\n");
printf ("A\tB\tC\tD\tE\tF");
printf ("\n_\t_\t_\t_\t_\t_\t");
for(i=1;i<7;i++)
{
cout<<endl;
printf("%d\t", A[i]);
printf("%d\t", B[i]);
printf("%d\t", C[i]);
printf("%d\t", D[i]);
printf("%d\t", E[i]);
printf("%d\t", F[i]);
}
cout <<"\n";
// Compare the members
int Minimum = A[0];
for (int i=1; i<7; i++)
if (minimum > A[i]) Minimum = A[i];
return minimum;
}
// Announce the result
cout << "The minimum value of the array A is "<< A[minA] << "." << endl;
}
}