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
affordable house cleaning Wilmette ..There are many commands that are used in linux on... Read More
OEComplete is a utility for managing the personal information of... Read More
Adobe Photoshop is one of the world's leading graphics editing... Read More
When it comes to running an office, the SOHO entrepreneur... Read More
Are Spreadsheets Robbing your Enterprise of Competitive Advantage?'90% of "average"... Read More
Sticky Noteshttp://www.deprice.com/stickynote.htmWith StickyNote 9.0, you can create beautiful 3D notes... Read More
Microsoft SQL Server is the leader for inexpensive and middle... Read More
Customer Relationship Management or CRM is a combination of enterprise... Read More
Whether you are a small consultancy firm, a medium sized... Read More
Considering whether or not your software company should hire a... Read More
We would like first emphasize the change in the paradigm.... Read More
With thousands of web pages added to the Net every... Read More
Microsoft Business Solutions Great Plains and MS CRM (client relation... Read More
This short paper will expand on two key reasons to... Read More
Music downloads are off the charts! We're listening to digital... Read More
It is really interesting that a bug can create problem... Read More
Spyware, what it is and what it does. Basically, spyware... Read More
We all take the computer for granted. I mean, all... Read More
New post-recession era has new features, which didn't exist in... Read More
Fortunately one of the most common reasons cited for the... Read More
If you are software developer or database administrator - we... Read More
.Net Framework is a platform or development environment to seamlessly... Read More
Anyone who has ever used Microsoft Word knows that it... Read More
Stealing company information used to be the specialty of spies... Read More
Remember old good days when your company probably had Great... Read More
quick home cleaning Northbrook ..In order to implement VLANs in a network environment, you'll... Read More
Learning how to program software seems like a daunting task... Read More
Microsoft Business Solutions CRM proved to be reliable solution in... Read More
And kill the best layout software in the process of... Read More
Looks like Microsoft Great Plains becomes more and more popular,... Read More
For a long time now Microsoft's Internet Explorer has ruled... Read More
Professional services firm cuts costs and improves productivity with integrated... Read More
I completed an experiment recently. I wanted to find out... Read More
Need software to record your voice, streaming audio or musical... Read More
While Adobe is the most known maker of PDF tools,... Read More
IntroductionPHP can be used for a lot of different things,... Read More
Handling character strings in Java is supported through two final... Read More
The Windows Indexing Service provides you with the ability to... Read More
I started using PIP (Picture It Publishing) Platinum 2002 right... Read More
Since its release in 1987, QuarkXpress had made an immediate... Read More
Having from five to ten and more favorite screensavers is... Read More
Combining Microsoft Business Solutions Great Plains ERP with non-Microsoft Business... Read More
Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More
Homeland security, airport security, Internet security ??" these days we???re... Read More
Healthcare facilities such as clinics, hospitals, and biomedical laboratories can... Read More
When Windows fails to boot it is normally caused by... Read More
Just when you thought you were Web savvy, one more... Read More
Many reasons made GBM a unanimous choice for experts, one... Read More
Microsoft Great Plains is one of three Microsoft Business Solutions... Read More
Does Microsoft care for WebmastersIt's always been a problem with... Read More
Software |