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
recurring cleaning service Wilmette ..ERP Consulting industry is on the way to serve clients... Read More
There are many commands that are used in linux on... Read More
Linux essentials:It's free for download but you have to pay... Read More
Most people don't use Photoshop to its fullest capabilities. Here... Read More
It's not very often I get excited about a software... Read More
Microsoft Business Solutions Navision serves both European and American megamarkets.... Read More
ERP (Enterprise Resource Planning) Overview covers What is ERP, Brief... Read More
Executive SummaryAn effective plan for entering, cleaning and updating the... Read More
While I was preparing some personal background information for a... Read More
What is 'adware'?Adware is basically software or scripts that are... Read More
If you use Microsoft Outlook (or similar applications) for e-mailing,... Read More
Professional services firm cuts costs and improves productivity with integrated... Read More
Our company, Novaprof Inc., developed unique software - DB Integration.... Read More
This article is the fourth of a series of articles... Read More
Microsoft Business Solutions Great Plains is mid and even corporate... Read More
Simply put, fleet maintenance allows companies to monitor and maintain... Read More
The intentions of this short tutorial are not to teach... Read More
Music downloads are off the charts! We're listening to digital... Read More
Combining Microsoft Business Solutions Great Plains ERP with non-Microsoft Business... Read More
The world of small business accounting software can be a... Read More
If you have Microsoft Great Plains and support it for... Read More
Great Plains Software Dynamics, Dynamics C/S+, eEnterprise were written on... Read More
FTP stands for "file transfer protocol". FTP is basically a... Read More
Preventive Maintenance (PM) is defined as scheduled work done on... Read More
The destruction of the Soviet Union about 15 years ago,... Read More
reliable maid service Morton Grove ..If you company is small or mid-size special products or... Read More
Scrapbooks are very popular these days. I think that almost... Read More
Microsoft Business Solutions Great Plains has many years of successful... Read More
Passwords protect your most sensitive personal, financial and business information.... Read More
All your software is stored on a hard-drive. But how... Read More
Looks like Microsoft Great Plains becomes more and more popular,... Read More
Microsoft Great Plains may be recommended for international freight forwarding... Read More
Currently Microsoft Business Solutions is on the way of creating... Read More
Customer Relationship Management, abbreviated "CRM," is the term for a... Read More
What is Spyware?Spyware monitors your surfing habits and sends the... Read More
Corporate ERP/MRP selection might be tough one, especially considering very... Read More
Ok... Where to start?Well, I guess I will start at... Read More
Microsoft Retail Management System serves retail single store as well... Read More
The Software 2005 conference is now a wrap. This conference,... Read More
"Pfishing", sometimes spelled "Phishing", is a word that's used to... Read More
We would like first emphasize the change in the paradigm.... Read More
Not all of us have the luxury of working both... Read More
There are many commands that are used in linux on... Read More
If you are in a business that passes documents around... Read More
Combining Microsoft Business Solutions Great Plains ERP with non-Microsoft Business... Read More
Spyware is like the new technological nuclear weapon on the... Read More
DBxtra goes ASPGetting to the information hidden within corporate databases... Read More
Handling character strings in Java is supported through two final... Read More
Did you ever want to erase everything on your computer?... Read More
When you buy a computer, it most likely comes with... Read More
Software |