Answer to Question #16092 in C++ for Joni Davis

Question #16092
our lesson is about Flow charting since I am still beginner in this topic I really need your help....
my Problem is
A program that will ask the user to input 3 numbers and determine the minimum number and maximum number
1
Expert's answer
2012-10-09T08:35:17-0400
#include <iostream>

using namespace std;

int main ()

{

int mn,mx;

const int Numb = 3;

int a[Numb]; //10 elements

cout<<"Enter 3 values:"; //prompts user for 3 values.

for(int i=0;i<3;i++)

{

cout<< "
Enter value: ";

cin>> a[i]; // puts values in array

}




mn=a[0];

mx=a[0];

for(int i=1;i<3;i++)

{

if(mn>a[i])

{

mn=a[i];

}

else if(mx<a[i])

{

mx = a[i];

}

}




cout<<"Maximum number is: "<< mx << endl;

cout<<"Minimum number is: "<< mn << endl;

system("PAUSE");

return 0;




}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS