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
|
|
|
|
|
|
|
|
|
|
|


One day, you suddenly realize that your computer started to... Read More
You have gotten those E_Mails buy software at deep discounts.... Read More
Microsoft Business Solutions Great Plains has several options to enable... Read More
Spyware is like the new technological nuclear weapon on the... Read More
It is really interesting that a bug can create problem... Read More
Microsoft Business Solutions ? Navision is an integrated solution for... Read More
IBM Lotus Notes with Domino email server is traditional document... Read More
Microsoft Business Solutions Great Plains is very popular ERP/MRP applications... Read More
What is Colossus?Colossus is software licensed to about twenty-five insurance... Read More
Microsoft Business Solutions ? Great Plains has captured the US... Read More
Case study: A secretary using Corel WordPerfect 7 is often... Read More
Around the same time Microsoft made its move with .Net... Read More
When you own a small business, time is money. And... Read More
Fleet Maintenance Management is a critical position in any company... Read More
Microsoft Business Solutions Great Plains might be considered as ERP... Read More
The Software 2005 conference is now a wrap. This conference,... Read More
Microsoft bought Navision, Denmark based software development company, along with... Read More
In order to meet regulatory and corporate compliance requirements reporting... Read More
As you probably know, when Microsoft purchased Great Plains Software... Read More
Microsoft CRM ? Client Relationship Management package from Microsoft Business... Read More
For those who are unclear on the differences between the... Read More
Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More
Microsoft Business Solutions Great Plains has I'd say end user... Read More
Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More
Preventive Maintenance (PM) is defined as scheduled work done on... Read More
We'll give you non formal view, based on our consulting... Read More
Software development is a risky business.Many software developers are barely... Read More
An integral part of any quality CRM system is lead... Read More
Before September of 1995, Microsoft ignored the Internet because their... Read More
Microsoft Great Plains is one of three Microsoft Business Solutions... Read More
Language development computer: Computer-based method for aiding language development seems... Read More
Shareware is software that you can try before you buy;... Read More
Let's say that you have a software project that's under... Read More


Microsoft Great Plains is becoming more and more popular and... Read More
Intro This concise article will tell you in plain English... Read More
Bill of Lading is required report for Logistics and Freight... Read More
Before September of 1995, Microsoft ignored the Internet because their... Read More
Many reasons made GBM a unanimous choice for experts, one... Read More
Logistics automation is often considered as barcoding extension to Sales... Read More
Handling character strings in Java is supported through two final... Read More
Adobe Photoshop is one of the world's leading graphics editing... Read More
Microsoft Great Plains is main Microsoft Business Solutions product, targeted... Read More
With any good luck and a good amount of hard... Read More
You turn on your computer, and it doesn't look quite... Read More
If you have Microsoft Great Plains and support it for... Read More
Microsoft Business Solutions CRM and IBM Lotus Notes Domino, being... Read More
Former Great Plains Software Dynamics/eEnterprise and currently Microsoft Business Solutions... Read More
Remember back in the days where screensavers were the coolest... Read More
For those who are unclear on the differences between the... Read More
Manufacturing in the USA is far away down from mid... Read More
Microsoft Business Solutions Great Plains is mid and even corporate... Read More
Microsoft Great Plains might be considered as ERP platform to... Read More
NOTE: Please take time to read on - it may... Read More
Hi, Guys,I believe a lot of programmers are trying to... Read More
Spyware, what it is and what it does. Basically, spyware... Read More
A LOT OF UNWANTED FILES.When you uninstall an item of... Read More
Microsoft released Service Pack 2 (SP2) for the Windows XP... Read More
Microsoft Great Plains is main Microsoft Business Solutions accounting package... Read More
IBM Lotus Domino or Microsoft Exchange?The severe competition continues for... Read More
SOFTWARE PIRACY We regularly hear reports... Read More
You would like to protect your documents, wouldn't you? Reasons... Read More
Every organization which creates collaborative documents, whether they are budgets,... Read More
With the advent of 'Service Pack 2' for Windows XP... Read More
Every day millions of new web documents emerge on the... Read More
Microsoft Great Plains is main Microsoft Business Solutions accounting package... Read More
If you copy something from a Web site or elsewhere...... Read More
Software |