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
disinfecting cleaning services Winnetka ..When reading an article where some term is used often,... Read More
As Mozilla Firefox nears 10% market share, with well over... Read More
Microsoft Client Relation Management system (Microsoft CRM) and Microsoft RMS... Read More
IBM Lotus Notes Domino and Microsoft CRM (Client Relation Management)... Read More
Buying accounting software is a major investment. It's an important... Read More
In today's business world it's all but impossible to escape... Read More
Is Photoshop CS2 worth the upgrade? You bet it is!... Read More
For a windows user like me, just can watch with... Read More
The destruction of the Soviet Union about 15 years ago,... Read More
In 2004 Oracle, Inc. made its new step toward J2EE... Read More
Remember back in the days where screensavers were the coolest... Read More
Many Webmasters have never bothered to view their website's server... Read More
Mike Dunville* had a decision to make. As the new... Read More
It's all about turn times in the eMedia industry! The... Read More
There are certain pluses and minuses in both cases and... Read More
IntroductionPHP can be used for a lot of different things,... Read More
Are you a whiz at calculating financial information? Not the... Read More
An operating system (abbreviated OS) is essentially the path through... Read More
Need software to record your voice, streaming audio or musical... Read More
In order to implement VLANs in a network environment, you'll... Read More
Configuring PPP PAP AuthenticationNow we know how the ISDN link... Read More
Formatting and reinstalling windows 98 is very easy if you... Read More
What is IRC?IRC is Internet Relay Chat. It is a... Read More
What is Colossus?Colossus is software licensed to about twenty-five insurance... Read More
Most people understand that the "hardware" part of their computer... Read More
last minute cleaning help Highland Park ..Microsoft Great Plains, Navision, Solomon and Axapta are Microsoft Business... Read More
Homeland security, airport security, Internet security ??" these days we???re... Read More
As Mozilla Firefox nears 10% market share, with well over... Read More
Logistics automation is often considered as barcoding extension to Sales... Read More
Lotus Domino/Notes ? Microsoft Great Plains tandem as ERP with... Read More
Microsoft has never released a service pack for Windows98 SE,... Read More
One of the main reasons business owners and entrepreneurs use... Read More
The cornerstone of successful automated office systems is the ability... Read More
Beginning with Domino version R4 it has integration with the... Read More
If you have Microsoft Great Plains and support it for... Read More
I like my software simple. If it's too complex or... Read More
Microsoft Business Solutions Great Plains, former Great Plains Software Dynamics... Read More
Microsoft Business Solutions Great Plains was designed back in the... Read More
Should one use Windows Update?This topic has good and valid... Read More
Small can be beautiful! Working with Knoppix for the past... Read More
In our small article we'll consider Microsoft Business Solutions Great... Read More
Microsoft Great Plains is now standard mid-market ERP application, serving... Read More
Microsoft Business Solutions is now in process of creating so... Read More
If you've been using MySQL database to store your important... Read More
When you first think about multicurrency ? you probably have... Read More
We would like first emphasize the change in the paradigm.... Read More
Microsoft Business Solutions Great Plains has several options to enable... Read More
Preventive Maintenance (PM) is defined as scheduled work done on... Read More
Microsoft Great Plains, designed back in 1990th as database transferable... Read More
Our company, Novaprof Inc., developed unique software - DB Integration.... Read More
Software |