This is the tutorial where we really get into programming. Input and variables are the essence of programming. In this tutorial you will learn how to get data from the user and use variables. You will learn the types of variables there are and how to do basic math with them. At first, this may seem boring and pointless, but you have to learn it, and it should go quick.
Basic Input
When you are making a console application, here is how you should get user input. Some of you may have guessed it, you use c[b]in[/b], of course, the 'c' meaning console and the 'in' meaning input, like 'cout'. So, here is a basic code, where the name of the variable x. cin>>x;
Defining Variables
A variable is what you guessed, a number or piece of data that will vary.
The diffrent types of variables:
bool - true or false
int - whole numbers
char - character (a, b, c, etc...)
string - multiple characters (words, etc..)
float,double - numbers that can have decimals
When deciding what type of variable to use, think about what kind of data it is going to be storing and remember that some data types use more memory than others, however most of your applications will use less memory than you have. To declare a variable, write the type of variable, then the name.
Examples:
int myInt = 7;
char thisChar= 'a', otherChar = 'b', char newChar;
string password= "password";
Syntaxes
Notice how I always had the first word not capatalized, but I capatalized all the other ones. You can also define more than one at a time, and you dont always need to set the value in the begining. Also, when you use a char, use a ' and for a string a ". Try to give your variables meaningful names.
Math
This is really the heart of programming, math! For now, we are going to be doing some simple arithmetic.
The basic math functions are:
+ = addition
- = subtraction
/ = division
* = multiplication
There are a bunch more, but that is all we need for now.
Go out and make a program!
Now that you know some of that basic stuff, try making a program, and dont be afraid to ask for help on http://www.syschat.com!
Chris Silop - http://www.syschat.com, Computer Forum
![]() |
|
![]() |
|
![]() |
|
![]() |
I provide, here clear explanations and a count of function... Read More
One of the main reasons business owners and entrepreneurs use... Read More
Words we choose to describe things and phenomena often show... Read More
As we could imagine, if you are reading this article... Read More
Microsoft Great Plains and Microsoft Retail Management System (Microsoft RMS)... Read More
When making a decision to buy any piece of software... Read More
DBxtra is a powerful query and reporting tool that hides... Read More
The intentions of this short tutorial are not to teach... Read More
There are certain pluses and minuses in both cases and... Read More
Microsoft Business Solutions Great Plains has Project Accounting module where... Read More
MS CRM is very close to document workflow automation, including... Read More
Microsoft Business Solutions Great Plains is very popular ERP platform... Read More
Microsoft Business Solutions products: Great Plains, MS CRM, Navision, Axapta,... Read More
Is your PC is slow and wimpy? Then you need... Read More
While I was preparing some personal background information for a... Read More
The first thing that you will notice about Linux Red... Read More
With this small article we are continuing Microsoft Business Solutions... Read More
All of us know that Microsoft bought former Great Plains... Read More
If you copy something from a Web site or elsewhere...... Read More
Microsoft SQL Server is the leader for inexpensive and middle... Read More
Microsoft Great Plains is now targeting large and midsize businesses... Read More
In order to meet regulatory and corporate compliance requirements reporting... Read More
If you have been running Windows XP for a couple... Read More
If you have Microsoft Great Plains as main accounting and... Read More
Microsoft Business Solutions Great Plains has full-featured manufacturing set of... Read More
GroupwareThe internet is full of 1.5 million to 7 million... Read More
Crystal Reports is the most flexible tool on the market... Read More
Background: For many organizations like ours, the interim target of... Read More
Since Version 8.0 Microsoft Business Solutions Great Plains & Great... Read More
What is Colossus?Colossus is software licensed to about twenty-five insurance... Read More
Following tips help you to learn a software in lesser... Read More
Microsoft CRM is new player on the CRM software... Read More
When reading an article where some term is used often,... Read More
Microsoft Great Plains, Navision, Solomon and Axapta are Microsoft Business... Read More
We all take the computer for granted. I mean, all... Read More
ERP is the acronym of Enterprise Resource Planning. Multi-module ERP... Read More
I have yet to see a business that, sometimes in... Read More
In a previous article, I wrote about OpenOffice... Read More
Microsoft Business Solutions Navision serves both European and American megamarkets.... Read More
Did you ever give a thought to the number of... Read More
Healthcare facilities such as clinics, hospitals, and biomedical laboratories can... Read More
Internet worms. Is your PC infected?If your computer has become... Read More
Document Manager and Version HistoryIn previous articles I have discussed... Read More
Have you ever noticed that when you look at your... Read More
This article illustrates the best practices to improve the performance... Read More
When you think... Read More
Bad News - the Threat is Bigger than it SeemedHow... Read More
The java programming language is becoming more and more popular... Read More
If you company is small or mid-size special products or... Read More
How would you like to prevent spyware and adware from... Read More
Before being able to choose a secure Internet communication system,... Read More
Microsoft Business Solutions Great Plains has many years of successful... Read More
Vince Lombardi once said that, "The achievements of an organization... Read More
Program Flow is what you think it is. How the... Read More
Are you a whiz at calculating financial information? Not the... Read More
Microsoft Business Solutions CRM is present several years on the... Read More
To all web designers out there, this article is for... Read More
It's not very often I get excited about a software... Read More
Before September of 1995, Microsoft ignored the Internet because their... Read More
The research in the field of Natural Language Processing usually... Read More
What is a Web Database?A web database is a database... Read More
With any good luck and a good amount of hard... Read More
New post-recession era has new features, which didn't exist in... Read More
Microsoft Business Solutions Great Plains is Dexterity-written application and currently... Read More
Customer Relationship Management, abbreviated "CRM," is the term for a... Read More
So, you've bought a new Macintosh, and now you may... Read More
Software |