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
elite cleaning services Des Plaines ..If you copy something from a Web site or elsewhere...... Read More
I have recently created my first Php program. I wanted... Read More
When you buy a computer, it most likely comes with... Read More
You have gotten those E_Mails buy software at deep discounts.... Read More
Microsoft Great Plains is main mid-market application from Microsoft Business... Read More
Just the thought of a duel-boot scares many people away,... Read More
Trying to figure out a stream in banning one email... Read More
New post-recession era has new features, which didn't exist in... Read More
Let's first look at your ERP system selection (without Retail... Read More
When you first think about multicurrency ? you probably have... Read More
Many reasons made GBM a unanimous choice for experts, one... Read More
The Windows Indexing Service provides you with the ability to... Read More
In 2004 Oracle, Inc. made its new step toward J2EE... Read More
For those who are unclear on the differences between the... Read More
Microsoft Business Solutions main middle market ERP application - Microsoft... Read More
Microsoft Business Solutions Small Business Manager is scaled down Great... Read More
FTP stands for "file transfer protocol". FTP is basically a... Read More
"Pfishing", sometimes spelled "Phishing", is a word that's used to... Read More
Microsoft Great Plains is main Microsoft Business Solutions product, targeted... Read More
Microsoft released Service Pack 2 (SP2) for the Windows XP... Read More
Imagine something that follows you home and sets itself up... Read More
Whether you have used Microsoft Word for years, have just... Read More
.NET platform does not support multiple inheritance. Do not confuse... Read More
If you have Microsoft Great Plains as main accounting and... Read More
MSN messenger is a pretty cool invention. I mean I'm... Read More
eco-friendly cleaning service Buffalo Grove ..In the real world a "fire wall" is a fireproof... Read More
In the previous ISDN article, we looked at how and... Read More
Following tips help you to learn a software in lesser... Read More
Great Plains Purchase Order Processing (POP) module makes up one-third... Read More
Microsoft Business Solutions Great Plains was designed back in the... Read More
When my daughter was getting into AOL instant messaging (AIM)... Read More
Ok... Where to start?Well, I guess I will start at... Read More
In the early days of the personal computer, we're talking... Read More
For those who are unclear on the differences between the... Read More
Microsoft SQL Server is the leader for inexpensive and middle... Read More
Google Inc. has launched a new software package that allows... Read More
Microsoft Business Solutions Great Plains has several options to enable... Read More
Microsoft CRM is new player on the CRM software... Read More
Homeland security, airport security, Internet security ??" these days we???re... Read More
#5 All your hardware components like Printers, PCs etc come... Read More
Every organization which creates collaborative documents, whether they are budgets,... Read More
Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More
What is Tripwire?Tripwire is a form intrusion detection system (IDS)... Read More
Great Plains Accounting, accounting package for mid-size and small companies... Read More
Microsoft Business Solutions ? Navision is an integrated solution for... Read More
Intro This concise article will tell you in plain English... Read More
Running Applications in Compatibility Mode With Windows XP, you can... Read More
Current Microsoft Business Solutions Great Plains has more that 10... Read More
Programming Help for BeginnersWe write programs to instruct computers. When... Read More
In the case when you represent mid-size or mid-size-to-large business,... Read More
Software |