C problems validating a credit card

You only need to call ceil for it: Now your switch statement. It is 13 digits long, not 15 or 16, so it could be a VISA card, but the results says its an AMEX card.

I prefer if-then-else statements, but I think this is ok here, even though it is very heavy because of all the code in there. The if statements inside the switch statement are very long and doing heavy stuff many times (pow and division are expensive operators.

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange This site uses cookies to deliver our services and to show you relevant ads and job listings.

In this case, the function expects a pointer to a character, so passing it a std::string just will not work.

I think it is a char* but your shouldn't have to think about pointers now, you will learn about them later any way, so we use the string type (if you try this and have problems, just replace string with char*). Now you can access each character directly (and you can determine the size of the number with strlen, so you don't have to do the ceil-log10-thing).

A string is indexed from the left to the right, so the first letter is the .

You cannot simple pass whatever kinds of variables you like into a function; you can only pass in variables of the correct type. Look up the string class functions - there are two in there that do what you want for finding the length of a std::string. You cannot simple pass whatever kinds of variables you like into a function; you can only pass in variables of the correct type. This is a really important aspect of programming in C (and many other languages).

Use the namespace std You can use the namespace std like this: using namespace std; This using namespace std::string; is not C code. There is no namespace called std::string I suspect you meantusing std::string; Error 1 error C2664: 'strlen' : cannot convert parameter 1 from 'std::string' to 'const char *' Error 2 error C2664: 'atoi' : cannot convert parameter 1 from 'char' to 'const char *' Error 3 error C2226: syntax error : unexpected type 'Card Type' Error 4 error C2226: syntax error : unexpected type 'Card Type' Error 5 error C2226: syntax error : unexpected type 'Card Type' Error 6 error C2226: syntax error : unexpected type 'Card Type' Error 7 error C2226: syntax error : unexpected type 'Card Type' Error 8 error C2226: syntax error : unexpected type 'Card Type' Error 9 error C2226: syntax error : unexpected type 'Card Type' Warning 10 warning C4060: switch statement contains no 'case' or 'default' labels Error 11 error C2065: 'i' : undeclared identifier Error 12 error C2065: 'i' : undeclared identifier Error 13 error C2065: 'i' : undeclared identifier Error 14 error C2065: 'i' : undeclared identifier Error 15 error C2065: 'i' : undeclared identifier Error 16 error C2065: 'i' : undeclared identifier Error 17 error C2440: 'initializing' : cannot convert from 'std::string' to 'Card Type' Error 18 error C2664: 'Validate' : cannot convert parameter 1 from 'std::string' to 'Card Type' strlen is a function that takes a single parameter. You have tried to feed the function a parameter that is not a char*. You can get a pointer to any object using the reference operator & - strlen is a function that takes a single parameter. You have tried to feed the function a parameter that is not a char*.

Leave a Reply

  1. Chat with fucking girl with video without putting email 15-Mar-2020 14:19

    Flirtlu is a free live sex chat website that has been rapidly gaining popularity lately.

  2. gabrielle union dating married man 16-Mar-2020 06:39

    Don't miss out, a must see solo amateur masturbation cam show! Come and check out this amazing solo amateur video featuring this super horny babe ramming and pounding her pussy with a big dildo till she squirts over and over again! Then she took her white dildo and started sucking it while imagining it was your dick she is sucking.

  3. accomodating to 01-Feb-2020 11:47

    Follow @robertmceachren , repost for my talented, creative guy: Apparently it's good #luck to #kiss under a waterfall #love #loveislove #fall #minnesota #beard #men #gay #gayguys #gayjock #boyfriends A photo posted by Sven Sundgaard (@svensundgaard) on The popular gay meteorologist himself confessed this we are not making it out.

  4. white label dating site 16-Oct-2019 22:57

    No license or membership is required to use features such as motion detection and remote monitoring from another computer, a phone or a tablet.