// Chairs.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "iostream"
#include "conio.h"
#include "string"
using namespace std;
int main()
{
const int NO=12;
string search;
double total;
double result;
int i=0;
total=0;
double min,max;
string isbn[NO]={"0-617-2133-X","1-444-7634-A","1-617-6543-5","0-876-2133-6","0-542-6578-X","1-582-7299-5","0-599-5222-4","0-433-7699-8","0-723-9855-6","0-719-7455-5","1-728-6723-3","0-488-7321-5"};
double price[NO]={35.00,49.95,56.99,22.9,45.70,61.70,34.95,25.9,78.8,54.8,45.00,34.95};
for(i=0;i<NO;i++)
{
cout<<"Price: "<<price[i]<<endl;
total += price[i];
}
cout<<"The Total is : "<<total;
min=price[0];
max=price[0];
for(i=0;i<=NO;i++);
{
if(price[i]>=min)
min=price[i];
}
for(i=0;i<=NO;i++);
{
if(price[i]<=max)
max=price[i];
}
cout<<"Minimum : "<<min<<endl;
cout<<"Maximum : "<<max<<endl;
cout<<endl<<"Please Enter the ISBN Number:";
getline(cin,search);
for(i=0;i<=NO;i++)
{
if(isbn[i]==search)
{
result=price[i];
}
}
cout<<"The Book Price You Entered is : "<<result;
_getch();
}
============================================================
In abobve Program I am not able to find Maximum
It's giving some Random Values
It's i<NO, not i<=NO. The difference is crucial.