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
efficient cleaning crew Lake Forest ..NOTE: Please take time to read on - it may... Read More
What is installation in the language of technology? Installation... Read More
This is a short article, written in question/answer/FAQ style to... Read More
Sales are all about leverage, because there is only so... Read More
In this small article we will be looking at the... Read More
Assertion facility is added in J2SE 1.4. In order to... Read More
Document Manager and Version HistoryIn previous articles I have discussed... Read More
Software development is a risky business.Many software developers are barely... Read More
New post-recession era has new features, which didn't exist in... Read More
Microsoft Great Plains - Microsoft Business Solutions accounting and ERP... Read More
Need help making sense of algebra? Have algebra lectures in... Read More
Microsoft Business Solutions Great Plains was purchased from Great Plains... Read More
We will base our prognosis on our Microsoft Business Solutions... Read More
(1) Avoid using the same variable again and again for... Read More
FTP stands for "file transfer protocol". FTP is basically a... Read More
Most computer users use spreadsheets software such as Microsoft Excel... Read More
There are certain pluses and minuses in both cases and... Read More
TCO (Total Cost Ownership) is the buzzword in... Read More
IBM Lotus Domino or Microsoft Exchange?The severe competition continues for... Read More
Document Management or Enterprise Information Management is perhaps one of... Read More
The cornerstone of successful automated office systems is the ability... Read More
Security flaws have long plagued Internet Explorer (IE), the market-dominating... Read More
All your software is stored on a hard-drive. But how... Read More
Vince Lombardi once said that, "The achievements of an organization... Read More
Formatting and reinstalling windows 98 is very easy if you... Read More
green cleaning service Deerfield ..Stealing company information used to be the specialty of spies... Read More
Finally, you have some time to personalize your desktop with... Read More
Microsoft Business Solutions Great Plains has substantial market share and... Read More
In this small article we will show you the possible... Read More
What is Spyware?Spyware monitors your surfing habits and sends the... Read More
Microsoft CRM is new player on the CRM software... Read More
Customer Relationship Management (CRM) is a strategy and processes used... Read More
We would like to give you pluses and minuses of... Read More
Great Plains Fixed Assets Management module is a robust tool... Read More
In this small article we will be looking at the... Read More
It would be easy to think, like most people apparently... Read More
Should one use Windows Update?This topic has good and valid... Read More
Enabling Chinese input is quick and easy, there are only... Read More
Make-or-Break Factors in Success and ProfitabilityFor quick printers, estimating can... Read More
Microsoft CRM has built-in conversion tool, however you should probably... Read More
Microsoft Business Solutions Great Plains, former Great Plains Software Dynamics/eEnterprise... Read More
Microsoft Great Plains is main mid-market application from Microsoft Business... Read More
If you are in the market for new staffing software,... Read More
Microsoft Business Solutions Great Plains version 8.5, 8.0, 7.5, Great... Read More
Here is some free software tools to help you build... Read More
People often ask me: What image file formats will Photoshop... Read More
Need software to record your voice, streaming audio or musical... Read More
An integral part of any quality CRM system is lead... Read More
Microsoft Business Solutions is emerging as very attractive vendor for... Read More
With any good luck and a good amount of hard... Read More
Software |