Yes I finally decided to continue on with my programming efforts. I would like to be able to refer to myself as a master programmer, but I may not have that much time, after all I am almost 80 years old. Right now I'm delving into C++ and finding it a little bit interesting, but it is early I've only been at it for a day and 1/2 now and already I am having questions. I am taking a course at UDemi but they never move along fast enough so I am always exploring ahead of the instructor as I am doing now. And I have a question? I need to be able to test an integer variable to be sure that the user enters integer data. So if there are any C++ programmers here, and I am sure there are, I would appreciate it if you could set me off in the right direction.

Oh, by the way, I lost all the feeling in my fingertips due to carpal tunnel syndrome and it made it quite impossible for me to type. But now I'm back and as you can see I am typing very well, but that is because I am not typing. I have the software that I paid a lot of money for called Dragon naturally speaking. And I just sit here and talk and the Dragon translates my speech into printed text.

Tata for now, will wait for your response and talk to y'all later.

I'd like to be able to help but it's been years since I did any c/c++ programming so any help I offered would either be outdated or just plain wrong. So why am I posting? I just had to ask - at 80, I have to assume that you are programming for the fun of it (like me). I don't know anyone who programs in c++ for fun. So if you could please enlighten me, why c++?

As Reverend Jim asks, why C++? Today if I need to do a thing I'm off to the land of Python.

Hello friends, yes you are correct. I am doing it mainly as a hobby. I hope to learn a lot more programming languages before I'm done, and yes I'm sure I will get to Python sooner or later. Another language that piques my interest and I haven't gotten to yet is Lua. I am a gamer as well as writing program code and I see this Lua in a lot of the games I play. I think the next language I'm going to take up after C++ is the C# because I am also learning unity and unity uses a lot of C# code to build the games with. Actually unity uses mostly C#. Thank you for your response I do appreciate it.

One more thing you must be careful what you ask for, because you just might get it, LOL. This is a cryptic statement but the person that it is directed to knows who they are. It is a good thing and all in good fun. The names have been changed to protect the guilty LOL.

I think it's wonderful, at nearly 80, that you decided to continue programming. I admire your ambition. I have written countless programs that no one will ever use except me, and I thoroughly enjoyed writing them. Go you!

I admire your ambition, programming is alot of fun. figuring out a Problem and making solutions

Assuming you want the user to retry and not create a fatal error, I would suggest reading the input as a string, then passing it to a simple verification function:

bool isNumeric(const std::string& input) {
    return std::all_of(input.begin(), input.end(), ::isdigit);
}

I believe you need atleast c++11 for this.

A GOOD training course gives you time to experiment and practice along with the course material, and knows you need that time to gain proficiency.
They also make sure they can meet the needs of both faster and slower students.

Which is what in my experience many Udemy course creators understand.

There are a lot of examples out there using the function isdigit.

#include <iostream> 
using namespace std; 

int main() 
{ 
int i,count;
string checkint;
cout<<"Enter a number : ";
cin>>checkint;

for (i = 0; i < checkint.length(); i++) 
{
        if (isdigit(checkint[i]) == false) 
{
count=1;
break;

} else
  count=0;

 } if(count==0)
    cout << "Integer"; 
  else
    cout << "Not Integer"; 
}

You're making it harder for yourself by considering lots of languages which can be subtly different and lead to frustration. Jumping from one language to another when it takes quite some time to master any one is a waste of time. Although once you know how to program in one language, the next one is easier, as you now know how a program should be structured. I started on C, then moved on to C++ which I didn't really like, and then did PHP the following year (I was taking courses at college, then uni, where various languages were taught in different courses). PHP suited me more and I still use it on some websites I have including some clients' sites. I'm not an expert but it does what I need.

With PHP you can easily display things in a browser - eg create a data input box on a web page that runs the PHP code and displays the answer in a new page. But PHP has gone all object orientated which means people invent a class that does what the same number of lines in a function can do but the function is easier to write and test.

To run PHP you need something like USB Webserver which runs the html and PHP in its own little world, and even allows you to work with databases. I personally just don't need the object orientated features of PHP for the things I do, and you probably don't either, so an older textbook on PHP and one on HTML would soon have you experimenting and enjoying the fun of programming. You can try online free courses but some are very simple and limiting, sometimes written by beginners who are practicing html and PHP themselves.

Python seems very popular now and has online courses, but I would never recommend C or C++ as a hobby language. But really try to stick to one language initially for a year or two before switching at random just to see what another does after a couple of months experimenting.

PS while I'm younger than you, I am an old person myself.

PPS Someone somewhere might recommend using a PHP framework, but that means you have to learn PHP AND the framework as well. As a hobbyist programmer, this would just drive you up the wall in frustration.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.