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
disinfecting cleaning services Winnetka ..Microsoft CRM is CRM answer from Microsoft Business Solutions.The whole... Read More
Many Webmasters have never bothered to view their website's server... Read More
Every day millions of new web documents emerge on the... Read More
Accounts payable is just one area of office management where... Read More
In the early days of the personal computer, we're talking... Read More
Fleet Maintenance Management is a critical position in any company... Read More
Programming Help for BeginnersWe write programs to instruct computers. When... Read More
To all web designers out there, this article is for... Read More
You might think you don't need a firewall... Read More
DBxtra is a powerful query and reporting tool that hides... Read More
CD and DVD replication is a process that works by... Read More
Whether you have used Microsoft Word for years, have just... Read More
The Internet is reshaping every form of communications medium, and... Read More
IBM Lotus Domino or Microsoft Exchange?The severe competition continues for... Read More
The destruction of the Soviet Union about 15 years ago,... Read More
Just the thought of a duel-boot scares many people away,... Read More
Microsoft Business Solutions offers several ERP applications: Great Plains, Navision,... Read More
Microsoft Great Plains is main accounting / ERP application... Read More
Microsoft Business Solutions Great Plains has substantial market share among... Read More
Siebel is traditional CRM market leader, however and mostly due... Read More
Having from five to ten and more favorite screensavers is... Read More
Do you remember that frustrating feeling when you find an... Read More
Ok... Where to start?Well, I guess I will start at... Read More
Whether you are an experienced web programmer or a complete... Read More
Microsoft Business Solutions Great Plains has many years of successful... Read More
last minute cleaning help Highland Park ..Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More
Whether you need to close a sale, gather end-user feedback,... Read More
Microsoft Great Plains, former Great Plains Software Dynamics / eEnterprise... Read More
Have you noticed WordPerfect is gearing up for a comeback... Read More
Microsoft Business Solutions Great Plains is very generic accounting application... Read More
While paper labeling CDs and DVDs may appear to be... Read More
What is Interactive Mapping?Interactive mapping is a visual display medium... Read More
The most important things you can do for your computer... Read More
Google Inc. has launched a new software package that allows... Read More
No matter how much you enjoy your favorite screensavers, sometimes... Read More
Think of this, first we had the HAM Radio, then... Read More
Microsoft CRM is winning market share step-by-step from such the... Read More
Having from five to ten and more favorite screensavers is... Read More
Finally, you have some time to personalize your desktop with... Read More
Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More
Logistics automation is often considered as barcoding extension to Sales... Read More
When it comes to screenplay software each screenwriter needs to... Read More
Introduction To ISDN, Part III: Configuring PPP PAP AuthenticationNow we... Read More
The cornerstone of successful automated office systems is the ability... Read More
Microsoft Outlook is one of the most widely used software... Read More
Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More
In the previous ISDN article, we looked at how and... Read More
Microsoft Great Plains might be considered as ERP platform to... Read More
Former Great Plains Software Dynamics/eEnterprise, and currently Microsoft Business Solutions... Read More
Do you want to get quality software at a reasonable... Read More
Software |