C++ :: Credit Card Validation - Type Selection

Nov 17, 2014

We have to ask the user to select either a Visa card type or Mastercard type. Then, we must ask the user to enter the 16 digit card number and determine if the card is valid or not using module 10. If the answer is zero then it is a valid Visa card and if the answer is zero the answer is a valid MasterCard. My problem is that the I have not separated the validation for MasterCard separate from visa.

Here is what I have so far:

#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
int main() {

string type, num;

[Code] ...

View 5 Replies


ADVERTISEMENT

C# :: Credit Card Validation - Not All Code Paths Return A Value

Jun 16, 2014

I have written the below but I get an error when I run it. I get the below error.

$mcs main.cs -out:demo.exe 2>&1

main.cs(93,58): warning CS0162: Unreachable code detected
main.cs(85,21): error CS0161: `CreditCards.CreditCardsValidator.LuhnCheckPerformed(string)': not all code paths return a value
Compilation failed: 1 error(s), 1 warnings

The code is below:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
/**@return a Credit Card Validation Application

[Code] ......

View 2 Replies View Related

C++ :: How To Create Type Validation Function

May 21, 2014

So I am writing an assignment to Detect prime numbers and it works by Asking for how many values you are going to enter, and then saying "Enter value 1: "

Then you would input and it would calculate via for loop, and that part is working. However to make my program more foolproof, I devised a way for the user to be unable to "Break" the program by inputting characters or float values. Here is the code for that:

while(!(cin >> num)){ //num is some type (char, float, int etc.)
cout << "That is not at valid input, please try again" << endl; //"Error Message"
cin.clear();
cin.ignore(10000, '
'); //Clear and reset cin
cout << "Enter value " << n << ": "; //Re-Prompt User for input
//n is whatever value the for loop is on
}

and this code works fine, I was just curious about how i would turn it into a function. Preferably wiht the name: ValidateInput(Param1, Param2);

The Parameters of the function preferably would be the variable youre inputting and the message you want to prompt. So somehow i wish to have it so for the above example it would look like:

ValidateInput(num, "Enter Value " << n << ": ");

But I don't know exactly how to label either parameter part because I want it to work for chars, ints, floats etc. And I don't know what I want it to return if anything either.

View 1 Replies View Related

C++ :: Flash Card Type Console Application - Declaring Array Of Hexadecimals

Dec 26, 2013

I'm making a flash card type console application using visual studios 2013. The flash cards contain character that I can display using unicode. So far I am looking at about 200 characters across 2 unicode blocks which I don't want to hard code into my arrays. I thought of initializing my arrays using a loop. The only problem is I don't know how to add in hexadecimal. So is there a way to initialize my array without having to input 200 values my self? Also is hexadecimal addition possible without me having to write a function for it?

View 3 Replies View Related

C++ :: Selection Process Using Roulette Wheel Selection?

Feb 9, 2013

I'm trying to make a selection process using roulette wheel selection. To do this I created two matrix, one random probabilities and one increasing probabilities. The idea is to choose a number according to the random probabilities. Here is the code I've written.

#include <iostream>
#include <conio.h>
#include <cstdlib>
using namespace std;
int main (){
float select [5], prob [10], mat [5];
int c, r, z;
cout.precision (2);
cout << "Random Number:" << endl;

[Code]...

The result I got is as follows:

Random Number:

0.0013 0.56 0.19 0.81 0.59

Increasing Probabilities:

0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

Selected Column:
0
5
6
8
9

The evaluation doesnt seem to start from c=0 again. The selected column should be 0, 5, 1, 8, 5.

View 6 Replies View Related

C :: How To Initialize Deck Of Card

Mar 25, 2014

The deck of cards so it is populated with all 52 cards. Once you have populated the deck, you need to shuffle the deck. Here is a simple algorithm you might consider for this purpose:

For each card up to the middle of the deck generate a random number modulus the size of the deck, swap the current card with the card at that location done

To implement this requirement you need to implement and use the following functions:

void initDeck(Card * deck);

View 4 Replies View Related

C++ :: Display Of Card 2D Array

Sep 9, 2013

i was reading trying to get it how to display the out put, all i got to is how to declare the arrays. How to start it also i saw some examples have " struct card"

the display should look like this:

2c 2h 2s 2d
3c 3h 3s 3d
4c 4h 4s 4d
5c 5h 5s 5d
6c 6h 6s 6d
7c 7h 7s 7d
8c 8h 8s 8d
9c 9h 9s 9d
10c 10h 10s 10d
Jc Jh Js Jd
Qc Qh Qs Qd
Kc Kh Ks Kd
Ac Ah As Ad

#include <iostream>
#include <iomanip>
using namespace std;
int main() {
int deck [13][4];
string suits [4] = {"h", "d","c","s"};
string values [13] = { "2", "3", "4", "5","6", "7"," 8" ,"9", "10"," J", "Q"," K" , "A"};
system ("pause");
return (0);
}

View 2 Replies View Related

C# :: Cricket Score Card?

Mar 24, 2010

I have to develop an application named smart client score board in c#

Main requirements for this application are that application should display the live scores, detailed score board, running commentary (in text), players and team profiles, statistics of matches, results and fixtures for cricket.

sort out websites which support rss feeds for full score card.

View 6 Replies View Related

C++ :: Program To Generate A Report Card?

Aug 28, 2013

For a school homework i had to make a c++ program to generate a report card so i made this program

#include<iostream.h>
#include<conio.h>
void main()
{

[Code].....

The problem is that it does not take any values ps I have been learning C++ for 3 months so we don't have any arrays,at max we have iterations

View 5 Replies View Related

C :: Retrieving SIM Card Number From Dongle Using Program?

Jan 2, 2014

I want to get or view the SIM card number from the dongle (the dongle will b already connected to the computer where the SIM card will be inserted into it) but the coding should be done by C programming / Language.

View 5 Replies View Related

C :: Card Shuffling - How Numbers Are Not Repeated In Function

Jan 27, 2014

I found a card shuffling function on a long dead thread.

Code:
for (int x = 52; x > 0 ; x--)
{ y = rand() % x;
temp = deck[x];
deck[x] = deck[y];
deck[y] = temp; }

I do not understand how numbers are not repeated in the function. It seems like it would be possible to get 2 cards with the same number with the above function.

I also am getting incorrect numbers. It seems like I should only get numbers between 1 and 52 (which is what I want). However, I am getting the number 0, and some number between 1 and 52 will be missing, but I will have a total of 52 unique numbers.

I played around with using 51 instead of 52, x > 1, and changed to --x and none of those produced the desired results.

View 5 Replies View Related

C++ :: Function To Randomly Determines Suit And Value Of A Card

Jul 19, 2013

I'm writing a card game and I'm having trouble getting the first part of it right, which is picking out a random card from the deck and displaying it to screen. So it's supposed to display a different card every time i run the function in the program. The problem is, I keep getting the same output every time "Nine of Hearts".

This is what I have so far,

#include <iostream>
using namespace std;
//declare two string arrays
//one holds the "suit" of the cards, the other hold the "value"
string suit[] = {"Diamonds", "Hearts", "Spades", "Clubs"};
string faceValue[] = {"Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ace", "King", "Queen", "Jack"};

[Code] ......

This is the output I keep getting every time I run the program:

Nine of Hearts

This "random selection" function I'm trying to do is meant to work as a means of shuffling the cards in the beginning of every round in the game and displaying only the top card from the deck.

View 1 Replies View Related

C/C++ :: Sorting A 10 Card Poker Hand Using Qsort?

Nov 8, 2014

I almost finished a program but am stuck on sorting the hand im dealing with qsort. sorting by the face values and if they have the same faces im suppose to follow this suit order to determine which one is greater (Clubs, Diamond, Hearts, and Spades) how would i adjust my comparator function to do this for me ?

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define DECK_SIZE 52
struct card {
const char *face;
const char *suit;

[code]....

View 4 Replies View Related

C/C++ :: Reading Barcode Card Scanners Output?

Jul 18, 2014

How can I get scanned barcodes from the barcode card scanner as a result to use it in c# database.

the platform is xp,7,8 and net framework 4

View 1 Replies View Related

C :: Retrieving Values That Are Stored To Compact Flash Card

Sep 19, 2013

My specific request is for retrieving values that are stored to a CompactFlash card. I am able to store values (we call them recipes) to the CompactFlash card as .csv file. I just haven't been able to figure out the code to retrieve this information back to the touchscreen.

Code:
// Create a new folder if it doesn't exist
CreateDirectory("/recipes");
//Create the file if it doesn't exist
CreateFile("/recipes/recipe.csv");
//open the file
hfile = OpenFile("/recipes/recipe.csv", 2);

[Code]....

Now with that said, I would like to retrieve these values from the .csv file.

View 7 Replies View Related

C :: Functions To Work With Graphics Card - Read Pixel Map

Nov 25, 2014

In this project I need to develop few functions to work with graphics card. I work in minix and this is pretty rubbish.

I'm having an hard time to read a pixel map, or atleast to print it on my main function.

I have a read_xpm function, which is given, therefore, working.

Code:
char *read_xpm(char *map[], int *wd, int *ht)

Then I have a pixmap.h file which gives some examples of pixmap images that I can use as example:

Code:
static char *pic1[] = {
"32 13 4",
". 0",
"x 2",
"o 14",
"+ 4",

[Code] ....

The doubt is. I have a test_xpm function and I need to call this char array but this is so many pointers that I can't even figure out where I'm pointed to (?)

Code: int test_xpm(unsigned short xi, unsigned short yi, char *xpm[])

I tried something like read_xpm(xi, yi, *xpm[0]); but I'm guessing I need to index that array and run all those chars in order to show them.

View 11 Replies View Related

C :: Program Which Recovers JPEGs From Raw File Of Memory Card

Mar 28, 2013

I am working on a c program which recovers jpeg files from .raw file of a memory card. My code is here-

Code:

#include<stdio.h>
#include<stdlib.h>
int main(void) {
File* inptr=fopen("card.raw","r")
if(inptr==NULL)

[Code]...

But while compiling it I get this error-

Makefile:2: *** missing separator. Stop.

View 2 Replies View Related

C :: War Card Game With Linked Lists And Dynamic Memory

Apr 23, 2013

I am struggling to finish up my game of War. There are a few problems I have ran in to. My shuffle function seems to work fine. I believe my problem lies within my game rules. When I run my code, the game usually plays all the way through but almost always ends in 'War'. I am struggling to get the game to restart after running once. I am not sure how to clear the list and start over.

Code:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <Windows.h>

[Code] ....

View 4 Replies View Related

C :: Read Text File From Memory Card Using Threading

Mar 25, 2013

I need do read a text file from memory card using threading.

I am able to do it with out using thread but because of some limitations, i have to do it with threading only.

Here is the code to read file from memory card with out thread:

Code: ##########################################
#include <stdio.h>
#include <stdlib.h>
#include <XMC4500.h> /* SFR declarations of the selected device */
#include <DAVE3.h> /* Declarations from DAVE3 Code
#include <stdio.h>
#include <string.h>
#include <stdbool.h>

[Code]...

View 4 Replies View Related

C++ :: Card Rand And Suit - Adding Dynamic Arrays

May 1, 2013

I'm writing a program with two classes, one that contains a card's rank and suit and the other contains pile of these cards. I'm having trouble when it comes to adding a pile to another pile...here's what I have so far:

class Card //Card class declaration
{
private:
int rank; //invoking rank
char suit; //invoking suit
public:
void setCard(int r,char s); //determines card suit/rank

[Code] ....

I understand that I'm calling my pile arrays incorrectly, but I'm not sure why.

View 1 Replies View Related

C++ :: Simple Playing Card Deck Creator And Shuffler

Aug 10, 2014

This is a playing card deck creator and shuffler i made yesterday. It is very simple now, but i believe that it could easily be implemented into a card game program of some sort.

#include <iostream>
#include <cstdlib>
#include <cstring>
#include <ctime>

#define STANDARD_DECK 52

[Code] .....

View 1 Replies View Related

C++ :: Finding Location Of A Vector - How To Retrieve Random Card (1 - 52)

Aug 7, 2014

I'm doing a card game and i'm unclear on how to retrieve the card by doing vectors. after i use use srand() in main and create a rand() in a function, how can i retrieve that random card 1-52?

so far i know that i have to find the length of the card. but i don't know why i have to save the location onto another variable and erase the card of the specified index before returning the card out the function.

int location = rand() % cards.size();

I don't know why i need to do this and how do i reinitialize the variable cards into another variable?

View 3 Replies View Related

C++ :: Program That Simulate Card Game - Array Manipulation

Apr 26, 2013

Consider a program that simulates a card game, with multiple player hands and a deck to draw from. Each hand can use an array to represent the cards it contains; sometimes it is useful to also declare an additional variable for each hand (or deck) indicating exactly how many cards are present.

1) Describe a simple function that would manipulate both the array representing a hand and the number indicating the size of the hand.

2) Describe a simple function that might be able to manipulate the array without referring to the hand size variable at all.

3) Generally, if the array was passed as a parameter to a function, how often would the hand size be included as a parameter?

View 2 Replies View Related

C++ :: Input Validation For Date?

Jul 19, 2013

How do you do the input validation for date? I used:

char rec.date[SIZE];
cout<<"date"<<endl;
cin.getline(date,SIZE);

I want the user to write in this format (mm/dd/yy)

View 3 Replies View Related

C++ :: Input Validation In For Loop

Aug 14, 2014

// PROBLEM - Use INPUT VALIDATION so number entered is positive. I can't get it to work

#include <iostream>
#include <iomanip>
using namespace std;
int main(int argc, const char * argv[]) {
// SUM OF NUMBERS
// Enter a positive integer

[Code] ....

View 2 Replies View Related

C/C++ :: Input Validation With Strings And Int

Apr 15, 2014

I am having a problem with my "void Validation :: getId()" function its suppose to get the id number from the user but when I try and type a letter to see if it catches it, it goes into this continuous loop. Also with my "string Validation :: getName(string name)" function it suppose to catch the comma in the user input for their last name , first name but doesn't catch it and still returns the name back to main function.

#include "InputValidation.h"
#include <iostream>
using namespace std;
Validation :: Validation() {
name = " ";
id = 0;

[Code] ....

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved