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
spotless home service Deerfield ..Internet worms. Is your PC infected?If your computer has become... Read More
Microsoft Office program is a programming tool called Visual Basic... Read More
The title of "software engineer" has got to be among... Read More
Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More
IBM Lotus Notes with Domino email server is traditional document... Read More
Microsoft Business Solutions Great Plains is mid and even corporate... Read More
The purpose of one of our projects was MS Exchange... Read More
Introduction to C++Why Learn C++?C++ may at first seem like... Read More
The Windows registry is a huge database that ensures normal... Read More
Looks like Microsoft Great Plains becomes more and more popular,... Read More
Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More
1. Replace Dexterity cursor with SQL Stored Procedure Dexterity... Read More
Do you want to get quality software at a reasonable... Read More
Although statistics often is blamed for various deadly sins --... Read More
I have recently created my first Php program. I wanted... Read More
Is Photoshop CS2 worth the upgrade? You bet it is!... Read More
In 2004 Oracle, Inc. made its new step toward J2EE... Read More
I love new technology. I am still ready to wait... Read More
Have you noticed WordPerfect is gearing up for a comeback... Read More
Microsoft Client Relation Management system (Microsoft CRM) and Microsoft RMS... Read More
ERP Consulting industry is on the way to serve clients... Read More
Software development is a risky business.Many software developers are barely... Read More
Finding the best spyware removers to detect and remove spyware... 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
spotless home service Buffalo Grove ..If you have been using the Internet for any amount... Read More
This short paper will expand on two key reasons to... Read More
Most computer users use spreadsheets software such as Microsoft Excel... Read More
If you're online using a dialup Internet connection, you'll probably... Read More
Fundraising software lets you connect with donors in a way... Read More
We were recently faced with a decision: either to let... Read More
Although we don't know whether Microsoft ever envisioned such a... Read More
In 2004 Oracle, Inc. made its new step toward J2EE... Read More
Many reasons made GBM a unanimous choice for experts, one... Read More
Your computer cost you from hundreds to thousands of dollars,... Read More
Microsoft Great Plains is main Microsoft Business Solutions product, targeted... Read More
Fortunately one of the most common reasons cited for the... Read More
Great Plains Fixed Assets Management module is a robust tool... Read More
Microsoft Business Solutions ? Great Plains has captured the US... Read More
After seeing many people complain about their weak Internet security... Read More
I have recently created my first Php program. I wanted... Read More
Buying accounting software is a major investment. It's an important... Read More
Since Version 8.0 Microsoft Business Solutions Great Plains & Great... Read More
The Microsoft system preparation utility for Windows 2000 is a... Read More
Manufacturing in the USA is far away down from mid... Read More
Bad News - the Threat is Bigger than it SeemedHow... Read More
When my daughter was getting into AOL instant messaging (AIM)... Read More
New post-recession era has new features, which didn't exist in... Read More
Microsoft Business Solutions Great Plains is very popular ERP platform... Read More
Whether you have used Microsoft Word for years, have just... Read More
Software |