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
home cleaning services Deerfield ..Microsoft Great Plains, former Great Plains Software Dynamics, eEnterprise has... Read More
All your software is stored on a hard-drive. But how... Read More
At the end of XX century, in the late 1990th... Read More
We would like to give you pluses and minuses of... Read More
Most people don't use Photoshop to its fullest capabilities. Here... Read More
Microsoft Business Solutions CRM is web-based CRM application, deploying all... Read More
Microsoft Business Solutions Great Plains serves multiple industries in the... Read More
Music downloads are off the charts! We're listening to digital... Read More
Three highly respected names in Human Resources have joined forces... Read More
This article is the third of a series of articles... Read More
Looking at all the ads which promise to get rid... Read More
Microsoft Business Solutions Great Plains is mid and even corporate... Read More
eStore Advantage allows front-office applications to communicate with back-office business... Read More
Microsoft Business Solutions CRM is present several years on the... Read More
If you have Microsoft Great Plains and support it for... Read More
What is 'adware'?Adware is basically software or scripts that are... Read More
Software development is a risky business.Many software developers are barely... Read More
The fact that a software tester is a most infamous... Read More
Healthcare facilities such as clinics, hospitals, and biomedical laboratories can... Read More
It is possible that if one avoided all sources of... Read More
Well, even if the combination might look very unusual, we... Read More
Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More
With so many Microsoft Windows related viruses, errors, and other... Read More
Task Manager is a Windows system utility that displays thetasks... Read More
When it comes to screenplay software each screenwriter needs to... Read More
recurring housekeeping Highland Park ..Document Manager and Version HistoryIn previous articles I have discussed... Read More
If your company has regional and worldwide operations, you might... Read More
When it comes to running an office, the SOHO entrepreneur... Read More
Microsoft Business Solutions main middle market ERP application - Microsoft... Read More
FTP stands for "file transfer protocol". FTP is basically a... Read More
Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More
DBxtra is a powerful query and reporting tool that hides... Read More
There are many commands that are used in linux on... Read More
For a long time now Microsoft's Internet Explorer has ruled... Read More
It won't matter how effective your WinRunner Team is if... Read More
Microsoft PowerPoint has dramatically changed the way in which academic... Read More
This article will not attempt to advocate the use of... Read More
The various resume software offered, particularly on the internet, can... Read More
Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More
People often ask me: What image file formats will Photoshop... Read More
Make-or-Break Factors in Success and ProfitabilityFor quick printers, estimating can... Read More
Looking at all the ads which promise to get rid... Read More
In 2004 Oracle, Inc. made its new step toward J2EE... Read More
Microsoft bought Navision, Denmark based software development company, along with... Read More
Just the thought of a duel-boot scares many people away,... Read More
Are you a whiz at calculating financial information? Not the... Read More
TikiWiki is open source software - it is written in... Read More
Here is some free software tools to help you build... Read More
When Windows fails to boot it is normally caused by... Read More
Microsoft released Service Pack 2 (SP2) for the Windows XP... Read More
Software |