Need C++ Programmer for Small Task
2015-06-22, 02:23 AM,
#1
I will pay if needed, PM me please if you know C++
Reply
2015-06-22, 04:27 AM,
#2
Small task? What kinda task?
Reply
2015-06-22, 01:24 PM,
#3
If you can elaborate on what kind of task, it would be better.
Reply
2015-06-22, 08:43 PM, (This post was last modified: 2015-06-22, 08:43 PM by NyanCat.)
#4
(2015-06-22, 04:27 AM)porphyritic Wrote: Small task? What kinda task?

(2015-06-22, 01:24 PM)HackTrack Wrote: If you can elaborate on what kind of task, it would be better.

It's about writing small program that checks if First name and Last name is typed correctly. It checks if first letters are uppercase and it checks if it's numbers. If you can help PM me pls.
Reply
2015-06-23, 05:44 AM, (This post was last modified: 2015-06-23, 05:45 AM by porphyritic.)
#5
Code:
#include <iostream>

int main()
{
    std::string first;
    std::string last;

    std::cin >> first >> last;

    if(std::isupper(first[0]) && std::isupper(last[0]))
    {
        //first char of first and last name are uppercase (true)
        if (!(std::isdigit(first[0])) && !(std::isdigit(last[0])))
        {
            //first char of first and last name are NOT digit
        }
    }
    return 0;
}
Latest Thanks - View all

NyanCat(2015-06-24 06:58 AM) 
Reply
2015-06-23, 07:04 AM,
#6
(2015-06-23, 05:44 AM)porphyritic Wrote:
Code:
#include <iostream>

int main()
{
    std::string first;
    std::string last;

    std::cin >> first >> last;

    if(std::isupper(first[0]) && std::isupper(last[0]))
    {
        //first char of first and last name are uppercase (true)
        if (!(std::isdigit(first[0])) && !(std::isdigit(last[0])))
        {
            //first char of first and last name are NOT digit
        }
    }
    return 0;
}


The first part of code works but i need to check full string if it's numbers, if it is then return error and repeat util it's entered correctly. Same for first part to repeat until correct. Thanks for helping.
Reply
2015-06-24, 06:35 AM,
#7
Well there are a few ways of doing this...

1: Just list all the numbers and see if your string contains one. Using the find() method

Code:
bool Person::contains_number(const std::string &c)
{
    return (
        c.find('0') != std::string::npos ||
        c.find('1') != std::string::npos ||
        c.find('2') != std::string::npos ||
        c.find('3') != std::string::npos ||
        c.find('4') != std::string::npos ||
        c.find('5') != std::string::npos ||
        c.find('6') != std::string::npos ||
        c.find('7') != std::string::npos ||
        c.find('8') != std::string::npos ||
        c.find('9') != std::string::npos
    );
}

2: Use the find_first_of() method

Code:
bool Person::contains_number(const std::string &c)
{
    return (c.find_first_of("0123456789") != std::string::npos);
}

If that still isn't what your looking for, let me know :)

~MoneyCashers
Latest Thanks - View all

NyanCat(2015-06-24 06:58 AM) 

Even if you don't believe in yourself... I will. :)

[Image: banner3.jpg]
Reply
2015-06-24, 06:58 AM,
#8
Thank you all guys, i completed this.
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Im a programmer, i can make mobile landings pwnisher 2 364 2017-07-28, 09:16 AM
Last Post: Pachu
  Got a good idea for a small app/website? I am Groot 0 833 2016-01-27, 05:01 AM
Last Post: I am Groot
  Looking for Assembler programmer Predatorius 2 498 2015-05-19, 04:33 AM
Last Post: Predatorius
  PHP VB Programmer wanted ...... GabberLevi 2 487 2014-07-24, 04:40 PM
Last Post: GabberLevi
  small problem with css dzep 1 369 2014-07-10, 05:27 PM
Last Post: Stone_Heart





About Us | Contact Us | CPA Elites | Advertise | Stats | Staff Team

© 2013-2017 CPA Elites Ltd
Enhanced by MyBB and WallBB
Return to top