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 ..Now that spyware is the single most dangerous threat to... Read More
Before September of 1995, Microsoft ignored the Internet because their... Read More
Microsoft Great Plains ? ERM from Microsoft Business Solutions and... Read More
What is IRC?IRC is Internet Relay Chat. It is a... Read More
We've all seen the ads on TV for Netzero 3G.... Read More
Great Plains Inventory Management (IV) module gives your business a... Read More
Fleet Maintenance Management is a critical position in any company... Read More
You would like to protect your documents, wouldn't you? Reasons... Read More
Microsoft CRM is relatively new player on the now becoming... Read More
A LOT OF UNWANTED FILES.When you uninstall an item of... Read More
While several preventive maintenance software manufacturers offer free trials for... Read More
It could just be me, but my experiences with document... Read More
Imagine something that follows you home and sets itself up... Read More
Every day millions of new web documents emerge on the... Read More
Looking at all the ads which promise to get rid... Read More
Microsoft Business Solutions Great Plains, Navision, Axapta, Solomon and CRM... Read More
Following tips help you to learn a software in lesser... Read More
Bad News - the Threat is Bigger than it SeemedHow... Read More
Microsoft PowerPoint has dramatically changed the way in which academic... Read More
Preventive Maintenance (PM) is defined as scheduled work done on... Read More
Background: For many organizations like ours, the interim target of... Read More
Language development computer: Computer-based method for aiding language development seems... Read More
You turn on your computer, and it doesn't look quite... Read More
When you first think about multicurrency ? you probably have... Read More
No matter how much you enjoy your favorite screensavers, sometimes... Read More
green cleaning service Deerfield ..If you feel intimidated when someone tries to teach you... Read More
For those who are unclear on the differences between the... Read More
Microsoft Business Solutions Great Plains, Navision, Axapta, Solomon and CRM... Read More
Microsoft Business Solutions Great Plains was historically designed to serve... Read More
Microsoft CRM is CRM answer from Microsoft and attempt to... Read More
C++ Function templates are those functions which can handle different... Read More
Software development is a risky business.Many software developers are barely... Read More
When you think... Read More
Microsoft Business Solutions Great Plains has several options to enable... Read More
How to delete the user? This is the first problem... Read More
An operating system (abbreviated OS) is essentially the path through... Read More
In a previous article, I wrote about OpenOffice... Read More
With this small article we are continuing Microsoft Business Solutions... Read More
Microsoft CRM customization techniques are very diversified and based on... Read More
You have gotten those E_Mails buy software at deep discounts.... Read More
Your computer cost you from hundreds to thousands of dollars,... Read More
FTP stands for "file transfer protocol". FTP is basically a... Read More
Programming Help for BeginnersWe write programs to instruct computers. When... Read More
This is a short article, written in question/answer/FAQ style to... Read More
Customer Relationship Management, abbreviated "CRM," is the term for a... Read More
Looks like Microsoft Great Plains becomes more and more popular,... Read More
Have you noticed WordPerfect is gearing up for a comeback... Read More
This article is for advanced Microsoft CRM SDK C# developers.... Read More
Find out why Spyware Removal from computers is important and... Read More
Microsoft Business Solutions Great Plains is mid and even corporate... Read More
Software |