1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
#include <iostream>
using namespace std;
int main()
{
int account[ 18 ] = {5658845, 4520125, 7895122,8777541, 8451277, 1302850,
8080152, 4562555, 5552012, 5050552, 7825877, 1250255,
1005231, 6545231, 3852085, 7576651,7881200, 4581002};
int number;
int choice = 0;
for (int i=0; i < 18; i++)
{
cout << "Please enter your account number(7 numbers).\n";
cin >> number;
while (number < 1000000 || number > 9999999)
{
cout << "Please enter a 7 digit number.\n";
cin >> number;
}
if (number == account[i])
{cout << "The number is valid.\n";
}
if (number != account[i])
{cout << "The number is invalid.\n";
}
do
{
cout << "Do you want to enter another account number?(y/n)\n";
cin >> choice;
}
while (choice != 'y' && choice != 'Y' && choice != 'n' && choice != 'N');
{
cout << "Please enter 'y' for yes or 'n' for no.\n";
cin >> choice;
}
while (choice == 'y' || choice =='Y');
{
cout << "Thank you and have a nice day!\n";
return 0;
}
}
return 0;
}
|