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
professional maid services Deerfield ..Fleet Maintenance Management is a critical position in any company... Read More
Microsoft Business Solutions Great Plains as new ERP for multinational... Read More
There are two approaches for application integration:? Programmer's approach ?... Read More
Ad-Aware and Spybot are probably the two most well known... Read More
While I was preparing some personal background information for a... Read More
NOTE: Please take time to read on - it may... Read More
Before September of 1995, Microsoft ignored the Internet because their... Read More
Almost all new and major brand of PCs come with... Read More
This is intermediate level SQL scripting article for DB Administrator,... Read More
Assertion facility is added in J2SE 1.4. In order to... Read More
Linux essentials:It's free for download but you have to pay... Read More
Microsoft bought Navision, Denmark based software development company, along with... Read More
If you are to buy a HelpDesk & Asset Management... Read More
Upgrading. Downtime. Maintenance. Hardware obsolescence. Implementation issues. The litany of... Read More
Microsoft Business Solutions Great Plains serves multiple industries in the... Read More
Most people understand that the "hardware" part of their computer... Read More
All of us know that Microsoft bought former Great Plains... Read More
What is a Web Database?A web database is a database... Read More
Not every software testing project can or should be automated.... Read More
In the Clinton era the status quo was simple: you... Read More
Let us give you - developer some hints in the... Read More
Sales are all about leverage, because there is only so... Read More
If you copy something from a Web site or elsewhere...... Read More
Spyware, what it is and what it does. Basically, spyware... Read More
Once upon a time not so long ago, there was... Read More
quick home cleaning Lake Forest ..Bad News - the Threat is Bigger than it SeemedHow... Read More
Now there are Three Steps To Heaven Just listen and... Read More
Having from five to ten and more favorite screensavers is... Read More
Microsoft Business Solutions Great Plains, former Great Plains Software eEnterprise,... Read More
Microsoft CRM is CRM application, maintained and supported by Microsoft... Read More
Microsoft Business Solutions products: Great Plains, MS CRM, Navision, Axapta,... Read More
Since technology changes so quickly, it is hard to begin... Read More
If your company has regional and worldwide operations, you might... Read More
We would like to give you pluses and minuses of... Read More
When Windows fails to boot it is normally caused by... Read More
The intentions of this short tutorial are not to teach... Read More
At the end of XX century, in the late 1990th... Read More
Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More
Microsoft CRM is now on the scene and it is... Read More
Microsoft Great Plains fits to majority of horizontals and retail... Read More
IBM Lotus Notes with Domino email server is traditional document... Read More
All your software is stored on a hard-drive. But how... Read More
Intro This concise article will tell you in plain English... Read More
Microsoft Office program is a programming tool called Visual Basic... Read More
Microsoft Business Solutions Small Business Manager is scaled down Great... Read More
I love new technology. I am still ready to wait... Read More
Usually, the easiest way to tell you have spyware is... Read More
The first thing that you will notice about Linux Red... Read More
In this article you will find some background information about... Read More
With many manufacturing shops heading over seas in favor of... Read More
Software |