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
best cleaning company Lincolnshire ..Microsoft CRM ? Client Relationship Management package from Microsoft Business... Read More
Fleet Maintenance Management is a critical position in any company... Read More
Blue Cross and Blue Shield of Hawaii (HMSA) found itself... Read More
Looks like Microsoft Great Plains becomes more and more popular,... Read More
Microsoft Business Solutions products: Great Plains, MS CRM, Navision, Axapta,... Read More
Microsoft Great Plains, Navision, Solomon and Axapta are Microsoft Business... Read More
Writing software manuals is boring, isn't it? We often think:... Read More
Microsoft Great Plains is now targeting large and midsize businesses... Read More
Usually, the easiest way to tell you have spyware is... Read More
Considering whether or not your software company should hire a... Read More
Having from five to ten and more favorite screensavers is... Read More
In order to implement VLANs in a network environment, you'll... Read More
While several preventive maintenance software manufacturers offer free trials for... Read More
In this small article we will be looking at the... Read More
Microsoft Retail Management System serves retail single store as well... Read More
You have gotten those E_Mails buy software at deep discounts.... Read More
In the Clinton era the status quo was simple: you... Read More
Should one use Windows Update?This topic has good and valid... Read More
Adware is a type of Spyware program that displays some... Read More
Microsoft Business Solutions Small Business Manager is Great Plains Dexterity... Read More
The term "document management" and "paperless office" is the subject... Read More
Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More
Here is some free software tools to help you build... Read More
This article is the third of a series of articles... Read More
Are you ready? SQL Server 2005, the next-generation data management... Read More
on demand house cleaning Lake Forest ..The Windows Indexing Service provides you with the ability to... Read More
We'll give you non formal view, based on our consulting... Read More
Looking at all the ads which promise to get rid... Read More
If you are in a business that passes documents around... Read More
Shareware has been fighting the stigma of being misunderstood for... Read More
Ad-Aware and Spybot are probably the two most well known... Read More
How to delete the user? This is the first problem... Read More
The Software 2005 conference is now a wrap. This conference,... Read More
In the real world a "fire wall" is a fireproof... Read More
Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More
The stakes are high when considering security, privacy, and savings,... Read More
In the Clinton era the status quo was simple: you... Read More
Fleet Maintenance Management is a critical position in any company... Read More
Learning how to program software seems like a daunting task... Read More
Finding the best spyware removers to detect and remove spyware... Read More
Scrapbooks are very popular these days. I think that almost... Read More
If you copy something from a Web site or elsewhere...... Read More
The first thing that you will notice about Linux Red... Read More
The most important things you can do for your computer... Read More
Great Plains Fixed Assets Management module is a robust tool... Read More
Microsoft Business Solutions Great Plains has full-featured manufacturing set of... Read More
While paper labeling CDs and DVDs may appear to be... Read More
Research bears that less than 70 percent of development projects... Read More
As of now - Great Plains Dynamics/eEnterprise is transformed/renamed into... Read More
If you are in the market for new staffing software,... Read More
Software |