Write a C++ program with a linear search only: You have been hired by the SFPD fraud unit to help detect credit card fraud. They have given you a list of 20 stolen credit card numbers, and want you to write a program that can detect if someone is attempting to use one of these credit card numbers at the local Target store. Your program should first read in a list of credit card numbers from a file into an array, and ask the user for a credit card number they would like to use. Then, search the array of credit card numbers to see if the credit card number is in the list. To simplify, we will use a 6 digit credit card number, e.g. 424238. Your list of stolen credit card numbers must be stored in an array of 20 ints. You can get a list from my website and read it in to initialize your array, it is sorted from lowest to highest card number. To get the list into your hills directory, you can use the wget command from the hills prompt: wget http://fog.ccsf.edu/~mluttrel/cs110b/cards.txt After running this command from the hills prompt, the file cards.txt will be in your hills directory, and your C++ program can use the file input code discussed in this module to read it into an array. If you are using another development environment, like repl.it, Xcode, etc. you will need to research how to add text files to your project and use them.
Write a C++ program with a linear search only: You have been hired by the SFPD fraud unit to help detect credit card fraud. They have given you a list of 20 stolen credit card numbers, and want you to write a program that can detect if someone is attempting to use one of these credit card numbers at the local Target store.
Your program should first read in a list of credit card numbers from a file into an array, and ask the user for a credit card number they would like to use. Then, search the array of credit card numbers to see if the credit card number is in the list.
To simplify, we will use a 6 digit credit card number, e.g. 424238. Your list of stolen credit card numbers must be stored in an array of 20 ints. You can get a list from my website and read it in to initialize your array, it is sorted from lowest to highest card number. To get the list into your hills directory, you can use the wget command from the hills prompt:
wget http://fog.ccsf.edu/~mluttrel/cs110b/cards.txt
After running this command from the hills prompt, the file cards.txt will be in your hills directory, and your C++ program can use the file input code discussed in this module to read it into an array. If you are using another development environment, like repl.it, Xcode, etc. you will need to research how to add text files to your project and use them.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 3 images