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 Arlington Heights ..Microsoft Business Solutions Great Plains has several options to enable... Read More
If you have been running Windows XP for a couple... Read More
Document Manager and Version HistoryIn previous articles I have discussed... Read More
Microsoft bought Navision, Denmark based software development company, along with... Read More
It won't matter how effective your WinRunner Team is if... Read More
We live in a post-industrial age where information is the... Read More
XML parser is a software module to read documents and... Read More
If someone entered your home, uninvited and installed numerous cameras... Read More
If you company is small or mid-size special products or... Read More
Microsoft Business Solutions Great Plains, Solomon, Navision, Axapta, Microsoft CRM... Read More
If your company has regional and worldwide operations, you might... Read More
What is Software?Software is a set of instruction written to... Read More
Microsoft CRM ? Client Relationship Management package from Microsoft Business... Read More
When you first think about multicurrency ? you probably have... Read More
Task Manager is a Windows system utility that displays thetasks... Read More
CD and DVD replication is a process that works by... Read More
When reading an article where some term is used often,... Read More
With many manufacturing shops heading over seas in favor of... Read More
Enabling Chinese input is quick and easy, there are only... Read More
Microsoft Business Solutions Great Plains was designed back in the... Read More
I have recently created my first Php program. I wanted... Read More
Microsoft Great Plains is main mid-market application from Microsoft Business... Read More
Here is some free software tools to help you build... Read More
It is a well known fact that Java as a... Read More
Are you lost in the mess of documents that get... Read More
bathroom cleaning service Mundelein ..The Windows Indexing Service provides you with the ability to... Read More
Microsoft Business Solutions ? Great Plains has captured the US... Read More
Microsoft has never released a service pack for Windows98 SE,... Read More
Every organization which creates collaborative documents, whether they are budgets,... Read More
What is a Web Database?A web database is a database... Read More
OEComplete is a utility for managing the personal information of... Read More
When you think... Read More
Trying to figure out a stream in banning one email... Read More
User interfaces and accessibility are some of the most important... Read More
The world of small business accounting software can be a... Read More
Looks like Microsoft Great Plains becomes more and more popular,... Read More
Fundraising software lets you connect with donors in a way... Read More
The adware and spyware definitions list is very long. But... Read More
You might think you don't need a firewall... Read More
Microsoft CRM is CRM answer from Microsoft Business Solutions. If... Read More
The intuitive algorithm.Roger Penrose considered it impossible. Thinking could never... Read More
Currently Microsoft Business Solutions is on the way of creating... Read More
In the Clinton era the status quo was simple: you... Read More
Microsoft Business Solutions Great Plains has several options to enable... Read More
The major reason I recommend getting your hands on real... Read More
Programming Help for BeginnersWe write programs to instruct computers. When... Read More
Microsoft Office program is a programming tool called Visual Basic... Read More
I completed an experiment recently. I wanted to find out... Read More
Since its release in 1987, QuarkXpress had made an immediate... Read More
DBxtra goes ASPGetting to the information hidden within corporate databases... Read More
Software |