Help with C++ programming exercises?

Matt

New member
1. write a C++ main program that prompts for and receives 25 floating point numbers from the console. The program then prints the smallest of the 25 numbers.

2. write a C++ segment to declare a one-dimensional array of X of 75 integers. Your program segment should print the average of all the numbers in the array. Assume X would already be initialized before your program segment is executed (do not initialize X).

3. write a C++ program segment to declare a 2-dimensional array Y with 5 rows and 10 colums, Your program segment should print the average of all the numbers in the array. Assume Y would already be initialized before your program segment is executed ( do not initialize Y).

So far this is what I have.
1. float number;
for(i=1; i<=25; i++)
{
cout<<"Enter in a floating point number";
cin>> num1;
cout<<"Enter in a floating point number";
cin>>num2;
}
if(num1 < num2)
cout<<num1;
else
cout<<num2;

2. for(i=0; i<75; i++)
int x[75];
sum=0;
sum+= A[75]/75;

3. int Y[5][10];
for(i=0;i< 5;i++)
for(j=0;j<10;j++)
sum=0;
sum+= Y[5][10]/15;
cout<<"The average of all the numbers is"<<sum;

I am a beginner to c++ and was hoping you guys could correct my errors.
 
Back
Top