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
no-contract cleaning service Glenview ..All of us know that Microsoft bought former Great Plains... Read More
I provide, here clear explanations and a count of function... Read More
Let us give you - developer some hints in the... Read More
Microsoft CRM has built-in conversion tool, however you should probably... Read More
Several years ago Microsoft purchased Great Plains Software, then Navision... Read More
As of now - Great Plains Dynamics/eEnterprise is transformed/renamed into... Read More
In order to implement VLANs in a network environment, you'll... Read More
Are you a whiz at calculating financial information? Not the... Read More
Case study: A secretary using Corel WordPerfect 7 is often... Read More
Hey Guys! Don't raise your eyebrows or fear by hearing... Read More
Microsoft Business Solutions Great Plains has substantial market share and... Read More
If you've been using MySQL database to store your important... Read More
Microsoft Business Solutions ? Great Plains has captured the US... Read More
2005 ? Back to the Future.What does the future hold?... Read More
Program Flow is what you think it is. How the... Read More
Looks like Microsoft Great Plains becomes more and more popular,... Read More
GroupwareEfforts are continually made to manage the unavoidable ad hoc... Read More
Spyware is software or hardware installed on a computer without... Read More
Microsoft Great Plains could be tuned and setup to fit... Read More
Handling character strings in Java is supported through two final... Read More
Microsoft Business Solutions CRM is present several years on the... Read More
Microsoft bought Navision, Denmark based software development company, along with... Read More
Microsoft Business Solutions is emerging as very attractive vendor for... Read More
Microsoft Business Solutions Great Plains, Solomon, Navision, Axapta, Microsoft CRM... Read More
It is a well known fact that Java as a... Read More
house cleaning company Glencoe ..Collaboration SoftwareCollaboration Software, also known as group collaboration software or... Read More
You've finally created databases that you can actually use to... Read More
Microsoft Great Plains is one of three Microsoft Business Solutions... Read More
In order to meet regulatory and corporate compliance requirements reporting... Read More
This article is the fourth of a series of articles... Read More
To all web designers out there, this article is for... Read More
When you buy a computer, it most likely comes with... Read More
A LOT OF UNWANTED FILES.When you uninstall an item of... Read More
Looks like Microsoft Great Plains becomes more and more popular,... Read More
Microsoft Business Solutions Great Plains has substantial market share among... Read More
In the early days of the personal computer, we're talking... Read More
If you feel intimidated when someone tries to teach you... Read More
Microsoft Great Plains and Microsoft CRM become more and more... Read More
People often ask me: What image file formats will Photoshop... Read More
Most people understand that the "hardware" part of their computer... Read More
Microsoft Business Solutions Great Plains serves multiple industries in the... Read More
User interfaces and accessibility are some of the most important... Read More
Great Plains Integration Manager scripting and translation - overview for... Read More
IntroductionDuring the early years of our modern computer era, very... Read More
We live in a post-industrial age where information is the... Read More
Microsoft Business Solutions CRM data conversion deserves FAQ type of... Read More
Microsoft Business Solutions Great Plains has full-featured manufacturing set of... Read More
We would like first emphasize the change in the paradigm.... Read More
RSS (Really Simple Syndication) is a way for a site... Read More
New post-recession era has new features, which didn't exist in... Read More
Software |