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
personalized cleaning services Des Plaines ..Microsoft Business Solutions Great Plains, former Great Plains Software eEnterprise,... Read More
In the real world a "fire wall" is a fireproof... Read More
Shareware has been fighting the stigma of being misunderstood for... Read More
In 2004 Oracle, Inc. made its new step toward J2EE... Read More
The purpose of one of our projects was MS Exchange... Read More
If your company has regional and worldwide operations, you might... Read More
In our opinion, traditional approach when you select ERP/MRP system... Read More
So let's begin crunching down these 300 images using Adobe... Read More
Assertion facility is added in J2SE 1.4. In order to... Read More
What is Spyware?Spyware monitors your surfing habits and sends the... Read More
We would like first emphasize the change in the paradigm.... Read More
Make-or-Break Factors in Success and ProfitabilityFor quick printers, estimating can... Read More
Microsoft Business Solutions Great Plains version 8.5, 8.0, 7.5, Great... Read More
Microsoft Great Plains might be considered as ERP platform to... Read More
Microsoft Business Solutions Great Plains is Dexterity-written application and currently... Read More
Are you ready? SQL Server 2005, the next-generation data management... Read More
Microsoft Business Solutions is emerging as very attractive vendor for... Read More
Upgrading. Downtime. Maintenance. Hardware obsolescence. Implementation issues. The litany of... Read More
Microsoft Business Solutions CRM is now approaching the phase of... Read More
The cornerstone of successful automated office systems is the ability... Read More
The intuitive algorithm.Roger Penrose considered it impossible. Thinking could never... Read More
What is Snort?Snort is an open source network intrusion detection... Read More
In the new era of internet marketing the problem of... Read More
This is the tutorial where we really get into programming.... Read More
Now that spyware is the single most dangerous threat to... Read More
family-safe home cleaners Arlington Heights ..IntroductionPHP can be used for a lot of different things,... Read More
Mapping Software Improves Data VisualizationFrom the outset, it is important... Read More
Language development computer: Computer-based method for aiding language development seems... Read More
Microsoft Great Plains could be tuned and setup to fit... Read More
During the years of our consulting practice, which comes back... Read More
A UNIX Shell is in simplest terms, a command line... Read More
C++ Function templates are those functions which can handle different... Read More
You would like to protect your documents, wouldn't you? Reasons... Read More
Linux essentials:It's free for download but you have to pay... Read More
Microsoft Business Solutions CRM proved to be reliable solution in... Read More
As of now - Great Plains Dynamics/eEnterprise is transformed/renamed into... Read More
Microsoft Business Solutions Great Plains and MS CRM (client relation... Read More
The cornerstone of successful automated office systems is the ability... Read More
Does Microsoft care for WebmastersIt's always been a problem with... Read More
I love new technology. I am still ready to wait... Read More
Microsoft CRM is now on the scene and it is... Read More
Before September of 1995, Microsoft ignored the Internet because their... Read More
Let's first look at your ERP system selection (without Retail... Read More
Google Inc. has launched a new software package that allows... Read More
For a long time now Microsoft's Internet Explorer has ruled... Read More
Microsoft Great Plains serves majority of US based horizontal and... Read More
In order to meet regulatory and corporate compliance requirements reporting... Read More
What is Snort?Snort is an open source network intrusion detection... Read More
It's all about turn times in the eMedia industry! The... Read More
Microsoft PowerPoint has dramatically changed the way in which academic... Read More
Software |