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
eco-friendly cleaning service Buffalo Grove ..I have yet to see a business that, sometimes in... Read More
I have always had a tendency to focus on the... Read More
Accounts payable is just one area of office management where... Read More
This article will not attempt to advocate the use of... Read More
Now that spyware is the single most dangerous threat to... Read More
Simply put, fleet maintenance allows companies to monitor and maintain... Read More
Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More
Microsoft Great Plains might be considered as ERP platform to... Read More
I have recently created my first Php program. I wanted... Read More
It would be easy to think, like most people apparently... Read More
Pirated software is on the increase and now accounts for... Read More
Adobe Photoshop is one of the world's leading graphics editing... Read More
Professional services firm cuts costs and improves productivity with integrated... Read More
Microsoft Business Solutions Great Plains was historically designed to serve... Read More
With so many Microsoft Windows related viruses, errors, and other... Read More
When it comes to running an office, the SOHO entrepreneur... Read More
Have you noticed WordPerfect is gearing up for a comeback... Read More
Fleet Maintenance Management is a critical position in any company... Read More
There are two major WYSIWYG(What You See Is What You... Read More
Navision Software was purchased by Microsoft and now it is... Read More
Microsoft Great Plains may be recommended for international freight forwarding... Read More
So, why should you use any O/R mapping tool? I... Read More
ERP is the acronym of Enterprise Resource Planning. Multi-module ERP... Read More
While paper labeling CDs and DVDs may appear to be... Read More
Whether you have used Microsoft Word for years, have just... Read More
express cleaning service Arlington Heights ..New post-recession era has new features, which didn't exist in... Read More
In this small article we will be looking at the... Read More
With thousands of web pages added to the Net every... Read More
Costs of fleet maintenance software can vary widely. It is... Read More
There are plenty of articles out there about how to... Read More
This article is the third of a series of articles... Read More
For a windows user like me, just can watch with... Read More
It's no secret that software companies operate in a very... Read More
Microsoft Business Solutions ? Great Plains has captured the US... Read More
As of now - Great Plains Dynamics/eEnterprise is transformed/renamed into... Read More
Three highly respected names in Human Resources have joined forces... Read More
It is a well known fact that Java as a... Read More
Before September of 1995, Microsoft ignored the Internet because their... Read More
Looks like Microsoft Great Plains becomes more and more popular,... Read More
Microsoft Business Solutions CRM is now approaching the phase of... Read More
If you have been using the Internet for any amount... Read More
If you have Microsoft Great Plains and support it for... Read More
Google Inc. has launched a new software package that allows... Read More
Navision Software was purchased by Microsoft and now it is... Read More
CD and DVD replication is a process that works by... Read More
Microsoft Great Plains, Navision, Solomon and Axapta are Microsoft Business... Read More
What is installation in the language of technology? Installation... Read More
Executive SummaryAn effective plan for entering, cleaning and updating the... Read More
Microsoft Business Solutions Great Plains, former Great Plains Software eEnterprise,... Read More
I have recently created my first Php program. I wanted... Read More
Software |