Blogs Blogs

C++ Program Blogs

Newest Most Active

Well done folks! We have finally arrived. This the third part of the three-part computer programming post. We will learn how to write a program that will accept data by user input through the keyboard and also print out a result to the computer monitor after performing a simple task of checking if the number is positive of negative. For simplicity, I have chosen the object-oriented, higher level programming language C++ to program the computer to perform a simple computation for us. We will write a C++ program that will prompt the user to type in an integer and the program will check whether the entered integer is positive or negative and display an appropriate output. //////////////////////// #include <iostream> using namespace std; int main() { /*variable declarations*/ int number; int threshold = 0; // we assume 0 is positive /*user prompted for input, then input received from keyboard*/ cout<<... read more

Some of us come with a knack to program computers and with little effort we can get the computer to work for us. On the other hand, some of us don't have a clue how to even get started. We may dread the errors that computer programs give such as "Compile error", or "undefined variable" or we may just be indifferent to anything computer programming related.   I will attempt to unpack the knowledge that has intrigued some of you into simpler and more understandable concepts. Let me start by stating that this series of blog posts is by no means a complete course on how to program a computer. However, I will give you the basics that you need to create simple computer programs. I will also give it to you in easy digestible pieces so it will not be too overwhelming. This way you can impress yourself and others with your newfound knowledge.   So you may ask yourself the question: "How do we bridge the knowledge gap?" I agree. Computers... read more

C++ Program Blogs RSS feed