Array

SCENARIO: ABC bank gives rewards to its customers for shopping online. Create a program that accepts the Name, PIN, and number of points earned for each customer. An input value of -1 for PIN should end the input.

The program should then CALCULATE:
1. The customer with the highest number of points
2. The customer with the lowest number of points
3. The average number of points


The program should then DISPLAY:
1. The customer name & points of customer with the highest of points as well as the number of points earned
2. The customer with the lowest number of points
3. The average number of points

HELP!!!
1
2
3
4
5
6
7
#include <iostream>
using namespace std;
int main (int argc, char *argv[])
{
// Put code here
return 0;
}
#include <iostream>
#include <string>
using namespace std;

int main ()


{

string Customer1, Customer2, Customer3, Customer4, Customer5;
int Pin1=0, Pin2=0, Pin3=0, Pin4=0, Pin5=0;
int Points1=0, Points2=0, Points3=0, Points4=0, Points5=0;
double Average=0.0;



cout<< "Enter each customers last name: ";
cin>> Customer1; cin>> Customer2; cin>> Customer3; cin>> Customer4; cin>> Customer5;
cout<< endl;

cout<< "Enter the each customer's PIN: ";
cin>> Pin1; cin>> Pin2; cin>> Pin3; cin>> Pin4; cin>> Pin5;

cout<< "\nEnter the number of ponits for each customer: ";
cin>> Points1; cin>> Points2; cin>> Points3; cin>> Points4; cin>> Points5;


if (Points1>Points2 && Points3 && Points4 && Points5) {
cout<< Customer1 ; cout<< Pin1 << " has the highest number of points: " << Points1 << " Pts";
}
else
if (Points2>Points1 && Points3 && Points4 && Points5){
cout<< Customer2 ; cout<< Pin2 << "has the highest number of points: " <<Points2<< " Pts";
}
else
if (Points3>Points1 && Points2 && Points4 && Points5){
cout<< Customer3 ; cout<< Pin3 << "has the highest number of points: " <<Points3<< " Pts";
}

else
if (Points4>Points1 && Points2 && Points3 && Points5){
cout<< Customer4 ; cout<< Pin4 << "has the highest number of points: " <<Points4<< " Pts";
}

else
if (Points5>Points1 && Points2 && Points3 && Points4){
cout<< Customer5 ; cout<< Pin5 << "has the highest number of points: " <<Points5<< " Pts";
}


Average= (Points1+Points2+Points3+Points4+Points5)/5;
cout<< "Average number of points is: " <<Average<<endl;







return 0;

}

Im having problems with the if else statements . Its not displaying the highest number of points.
Last edited on
Topic archived. No new replies allowed.