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
cleaning help near Mundelein ..Having from five to ten and more favorite screensavers is... Read More
Once a business idea is selected, it is highly recommended... Read More
Table of Contents1) Introduction 2) Related Work 3) Framework 4)... Read More
In the early days of the personal computer, we're talking... Read More
If you are in a business that passes documents around... Read More
There are two major WYSIWYG(What You See Is What You... Read More
IntroductionSurprised, by the title? well, this is a tour of... Read More
One of the things we can be as certain of... Read More
This article will not attempt to advocate the use of... Read More
Need help making sense of algebra? Have algebra lectures in... Read More
Almost all new and major brand of PCs come with... Read More
Spyware is software or hardware installed on a computer without... Read More
Configuring PPP PAP AuthenticationNow we know how the ISDN link... Read More
Are you a whiz at calculating financial information? Not the... Read More
The first topic we are going to discuss... Read More
#5 All your hardware components like Printers, PCs etc come... Read More
A few months back I really got sick of my... Read More
Are you one of those people that keeps track of... Read More
With many manufacturing shops heading over seas in favor of... Read More
With this small article we are continuing Microsoft Business Solutions... Read More
Spyware and Adware infest over 90 percent of computers in... Read More
Microsoft CRM is CRM answer from Microsoft Business Solutions.The whole... Read More
For those who still don't know, Microsoft Publisher helps computer... Read More
How to delete the user? This is the first problem... Read More
Microsoft Business Solutions Navision serves both European and American megamarkets.... Read More
reliable maid service Wilmette ..Stealing company information used to be the specialty of spies... Read More
For a long time now Microsoft's Internet Explorer has ruled... Read More
Disclaimer: All the thoughts expressed are my views only! Your... Read More
Great Plains Software Dynamics, Dynamics C/S+, eEnterprise were written on... Read More
The software giants don't do everything and don't always produce... Read More
SAP Inc., a global leader in client/server enterprise application software... Read More
If you have Microsoft Great Plains as main accounting and... Read More
A UNIX Shell is in simplest terms, a command line... Read More
Spyware is like the new technological nuclear weapon on the... Read More
Now that spyware is the single most dangerous threat to... Read More
Microsoft Business Solutions Great Plains, Solomon, Navision, Axapta, Microsoft CRM... Read More
Considering whether or not your software company should hire a... Read More
After almost two decades of existence, Quark has become the... Read More
Microsoft CRM ? Client Relationship Management package from Microsoft Business... Read More
In a previous article, I wrote about OpenOffice... Read More
We've all seen the ads on TV for Netzero 3G.... Read More
Each Industry and market niche has business specific and unique... Read More
Microsoft Business Solutions Great Plains has substantial market share and... Read More
Cyberspace has opened up a new frontier with exciting possibilities... Read More
Since technology changes so quickly, it is hard to begin... Read More
The first topic we are going to discuss... Read More
Manufacturing in the USA is far away down from mid... Read More
Sales are all about leverage, because there is only so... Read More
The destruction of the Soviet Union about 15 years ago,... Read More
Are you a database professional? Do you work with a... Read More
Software |