Credit Card C++

Companies that issue credit cards often use algorithms to create credit card numbers that people will have difficulty generating at random. One approach is to add the digits of a number and add 0 or 1 to make the sum of the digits even. For example, the number 45931 (that is, 4+ 5 + 9 + 3 + 1 =22 and is even) would be acceptable, but the number 37230 (that 9s 3 + 7 + 2 +3 = 15 and is odd) would not. The last digit in the number, either a1 or a 0, is called the check digit. Write a program that inputs a four digit number form a text file called Lab1C, , generates the check digit, and displays the original number, check digit number and five-digit credit card number.

This is what I have so far to open and read the file. If anyone knows anything else let me know. Thank you.

#include <iostream>
#include <fstream>

using namespace std;

int main()
{
int i, number[100], maxRows, remaining, Check_num, temp[5];

ifstream input;

// tells user where the file is located.
//Must be very specific in order to access
input.open("C:\\Users\\Chelsey\\My Documents\\Visual Studio 2010\\Projects\\Credit_Card_List\\Credit_Card_List.txt");

i = 0;

//EOF (end of file) enables user to read the file from where ever it my be stored

while(!input.eof())
{
input >> number[i];
i++;
}

maxRows = i;

cout << "Numbers to be used: " << endl;

for(i = 0; i < maxRows; i++)
{
cout << number[i] << endl;
}

system ("pause");
return 0;
Topic archived. No new replies allowed.