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
tidy up service Glenview ..Looks like Microsoft Great Plains becomes more and more popular,... Read More
The most important things you can do for your computer... Read More
It's all about turn times in the eMedia industry! The... Read More
As we could imagine, if you are reading this article... Read More
Spyware is like the new technological nuclear weapon on the... Read More
During the years of our consulting practice, which comes back... Read More
Navision Software was purchased by Microsoft and now it is... Read More
Microsoft Business Solutions Great Plains has several options to enable... Read More
If you have Microsoft Great Plains and support it... Read More
Microsoft Great Plains is main accounting / ERP application... Read More
Our hosted solution allow you to run your own search... Read More
Customer Relationship Management, abbreviated "CRM," is the term for a... Read More
Anyone who has ever used Microsoft Word knows that it... Read More
Are you ready? SQL Server 2005, the next-generation data management... Read More
The stakes are high when considering security, privacy, and savings,... Read More
This article is the fourth of a series of articles... Read More
Looks like Microsoft Great Plains becomes more and more... Read More
Great Plains Fixed Assets Management module is a robust tool... Read More
2005 ? Back to the Future.What does the future hold?... Read More
Microsoft Great Plains is one of the Microsoft Business Solutions... Read More
Microsoft CRM is relatively new player on the now becoming... Read More
Microsoft Great Plains as ERP and Microsoft CRM as... Read More
Microsoft Business Solutions Navision serves both European and American megamarkets.... Read More
... Read More
In the case when you represent mid-size or mid-size-to-large business,... Read More
maid service near Winnetka ..COMMAND LINE FUNCTIONA powerful command line script processor has been... Read More
Many Webmasters have never bothered to view their website's server... Read More
Before being able to choose a secure Internet communication system,... Read More
GroupwareThe internet is full of 1.5 million to 7 million... Read More
Great Plains Accounting, accounting package for mid-size and small companies... Read More
We would like to give you several situations, when you... Read More
The fact that a software tester is a most infamous... Read More
Whether you need to close a sale, gather end-user feedback,... Read More
In 2004 Oracle, Inc. made its new step toward J2EE... Read More
The adware and spyware definitions list is very long. But... Read More
Accounts payable is just one area of office management where... Read More
Microsoft Great Plains is becoming more and more popular and... Read More
The various resume software offered, particularly on the internet, can... Read More
So let's begin crunching down these 300 images using Adobe... Read More
Handling character strings in Java is supported through two final... Read More
Ok... Where to start?Well, I guess I will start at... Read More
Microsoft Great Plains, Navision, Solomon and Axapta are Microsoft Business... Read More
Finally, you have some time to personalize your desktop with... Read More
We don't think about mainframe software pricing anymore, we just... Read More
Before September of 1995, Microsoft ignored the Internet because their... Read More
The purpose of Project Management Software is to provide an... Read More
In the case when you represent mid-size or mid-size-to-large business,... Read More
Once a business idea is selected, it is highly recommended... Read More
TCO (Total Cost Ownership) is the buzzword in... Read More
And kill the best layout software in the process of... Read More
Software |