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
home cleaning services Deerfield ..Ad-Aware and Spybot are probably the two most well known... Read More
Great Plains Accounting, accounting package for mid-size and small companies... Read More
Great Plains Software Dynamics, Dynamics C/S+, eEnterprise were written on... Read More
I have always had a tendency to focus on the... Read More
Many Webmasters have never bothered to view their website's server... Read More
How many steps does it take you to locate and... Read More
Shareware is software that you can try before you buy;... Read More
Costs of fleet maintenance software can vary widely. It is... Read More
Now is the time to look at an alternative to... Read More
Just imagine: you are walking, say, towards your car, and... Read More
Microsoft Business Solutions Great Plains was designed back in the... Read More
In part III of this ISDN primer, we learned that... Read More
In the case when you represent mid-size or mid-size-to-large business,... Read More
IntroductionPHP can be used for a lot of different things,... Read More
If you're online using a dialup Internet connection, you'll probably... Read More
Introduction to C++Why Learn C++?C++ may at first seem like... Read More
ERP Consulting industry is on the way to serve clients... Read More
Spyware is like the new technological nuclear weapon on the... Read More
All of us know that Microsoft bought former Great Plains... Read More
Your computer cost you from hundreds to thousands of dollars,... Read More
IBM Lotus Domino or Microsoft Exchange?The severe competition continues for... Read More
The major reason I recommend getting your hands on real... Read More
SOFTWARE PIRACY We regularly hear reports... Read More
The Microsoft system preparation utility for Windows 2000 is a... Read More
Running Applications in Compatibility Mode With Windows XP, you can... Read More
recurring housekeeping Highland Park ..If you company is small or mid-size special products or... Read More
Microsoft CRM was designed to be easily customizable. Microsoft CRM... Read More
Our hosted solution allow you to run your own search... Read More
Whether you are an experienced web programmer or a complete... Read More
Rapid Application Development (RAD) is a software development methodology. In... Read More
We will base our prognosis on our Microsoft Business Solutions... Read More
Buying accounting software is a major investment. It's an important... Read More
This article is the third of a series of articles... Read More
No matter how much you enjoy your favorite screensavers, sometimes... Read More
IBM Lotus Notes with Domino email server is traditional document... Read More
You might think you don't need a firewall... Read More
How to delete the user? This is the first problem... Read More
Healthcare facilities such as clinics, hospitals, and biomedical laboratories can... Read More
What is Spyware?Spyware monitors your surfing habits and sends the... Read More
Microsoft Business Solutions Great Plains, former Great Plains Software Dynamics... Read More
Usually workflow & messaging is realized in CRM and then... Read More
Finding the best spyware removers to detect and remove spyware... Read More
I provide, here clear explanations and a count of function... Read More
Software Engineering is the Systematic Approach for analysis design implementation... Read More
Are you ready? SQL Server 2005, the next-generation data management... Read More
Intro This concise article will tell you in plain English... Read More
Microsoft bought Navision, Denmark based software development company, along with... Read More
With any good luck and a good amount of hard... Read More
SAP Inc., a global leader in client/server enterprise application software... Read More
The title of "software engineer" has got to be among... Read More
Software |