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
eco-friendly cleaning service Buffalo Grove ..Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More
Microsoft Great Plains is main Microsoft Business Solutions accounting package... Read More
There are several kinds of software piracy. The bottom line... Read More
Microsoft CRM was designed to be easily customizable. Microsoft CRM... Read More
Microsoft Great Plains and Microsoft Retail Management System (Microsoft RMS)... Read More
When making a decision to buy any piece of software... Read More
Case study: A secretary using Corel WordPerfect 7 is often... Read More
When you own a small business, time is money. And... Read More
The adware and spyware definitions list is very long. But... Read More
Microsoft SQL Server is the leader for inexpensive and middle... Read More
Best Software Act! is very popular CRM for small and... Read More
The first thing that you will notice about Linux Red... Read More
Microsoft Great Plains and Microsoft Retail Management System (Microsoft RMS)... Read More
Microsoft Business Solutions Great Plains was historically designed to serve... Read More
Introduction To ISDN, Part III: Configuring PPP PAP AuthenticationNow we... Read More
Microsoft CRM ? Client Relationship Management package from Microsoft Business... Read More
If you have Microsoft Great Plains as main accounting and... Read More
When my daughter was getting into AOL instant messaging (AIM)... Read More
Just the thought of a duel-boot scares many people away,... Read More
Writing software manuals is boring, isn't it? We often think:... Read More
Every organization which creates collaborative documents, whether they are budgets,... Read More
What is Interactive Mapping?Interactive mapping is a visual display medium... Read More
Innovative Maintenance Systems (IMS) is one company that offers solutions... Read More
Former Great Plains Software Dynamics/eEnterprise and currently Microsoft Business Solutions... Read More
OEComplete is a utility for managing the personal information of... Read More
express cleaning service Arlington Heights ..Microsoft Business Solutions Small Business Manager is scaled down Great... Read More
One of the things we can be as certain of... Read More
Microsoft Great Plains is now targeting large and midsize businesses... Read More
With this small article we are continuing Microsoft Business Solutions... Read More
Whether you need to close a sale, gather end-user feedback,... Read More
Scrapbooks are very popular these days. I think that almost... Read More
Combining Microsoft Business Solutions Great Plains ERP with non-Microsoft Business... Read More
Although we don't know whether Microsoft ever envisioned such a... Read More
The title of "software engineer" has got to be among... Read More
After seeing many people complain about their weak Internet security... Read More
The US House of Representatives has recently passed the "Spy... Read More
Microsoft Business Solutions Great Plains serves multiple industries in the... Read More
The term "document management" and "paperless office" is the subject... Read More
Microsoft Business Solutions Great Plains has full-featured manufacturing set of... Read More
Microsoft Great Plains is main mid-market application from Microsoft Business... Read More
Microsoft Business Solutions Great Plains might be considered as ERP... Read More
Did you ever want to erase everything on your computer?... Read More
Spyware, what it is and what it does. Basically, spyware... Read More
According to a survey conducted by InfoTrends/CAP Ventures entitled "Content-Centric... Read More
Every organization which creates collaborative documents, whether they are budgets,... Read More
Microsoft CRM is CRM answer from Microsoft Business Solutions.The whole... Read More
Although statistics often is blamed for various deadly sins --... Read More
Microsoft bought Navision, Denmark based software development company, along with... Read More
Before September 1995, Microsoft Windows was an MS-DOS program. DOS... Read More
Microsoft Word is one of the most popular office applications... Read More
Software |