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
recurring cleaning service Wilmette ..During the years of our consulting practice, which comes back... Read More
There are plenty of articles out there about how to... Read More
In 2004 Oracle, Inc. made its new step toward J2EE... Read More
Using professional icons in your application or website can bring... Read More
Microsoft Business Solutions Great Plains was purchased from Great Plains... Read More
With so many Microsoft Windows related viruses, errors, and other... Read More
Customer Relationship Management (CRM) is a strategy and processes used... Read More
It's all about turn times in the eMedia industry! The... Read More
With thousands of web pages added to the Net every... Read More
So, why should you use any O/R mapping tool? I... Read More
As Mozilla Firefox nears 10% market share, with well over... Read More
Words we choose to describe things and phenomena often show... Read More
Did you ever want to erase everything on your computer?... Read More
A LOT OF UNWANTED FILES.When you uninstall an item of... Read More
Introduction: The creating of a computer program involves a number... Read More
A few months back I really got sick of my... Read More
Software Engineering is the Systematic Approach for analysis design implementation... Read More
Microsoft Retail Management System serves retail single store as well... Read More
C++ Function templates are those functions which can handle different... Read More
Bar charts, bar graphs, and any other chart or graph... Read More
Spyware and malware are large problems for Internet users today... Read More
User interfaces and accessibility are some of the most important... Read More
Microsoft Business Solutions Great Plains was historically designed to serve... Read More
Great Plains Inventory Management (IV) module gives your business a... Read More
When Great Plains Software was designing and developing Great Plains... Read More
reliable maid service Morton Grove ..Microsoft Business Solutions CRM proved to be reliable solution in... Read More
Microsoft CRM is CRM answer from Microsoft Business Solutions.The whole... Read More
If you have been running Windows XP for a couple... Read More
What is Tripwire?Tripwire is a form intrusion detection system (IDS)... Read More
The vast majority of us will have, at some point,... Read More
If you would like to pick something from Microsoft, or... Read More
The intentions of this short tutorial are not to teach... Read More
When you own a small business, time is money. And... Read More
Microsoft Retail Management (RMS) and Microsoft Great Plains are retail... Read More
Language development computer: Computer-based method for aiding language development seems... Read More
Just the thought of a duel-boot scares many people away,... Read More
Manufacturing in the USA is far away down from mid... Read More
In this small article we will be looking at the... Read More
Spyware is like the new technological nuclear weapon on the... Read More
Trying to figure out a stream in banning one email... Read More
Microsoft CRM is CRM answer from Microsoft and attempt to... Read More
Customer Relationship Management or CRM is a combination of enterprise... Read More
Microsoft Business Solutions Great Plains was purchased from Great Plains... Read More
Most people understand that the "hardware" part of their computer... Read More
If you look back to the history, you will see... Read More
Microsoft Great Plains and Microsoft Retail Management System (Microsoft RMS)... Read More
After almost two decades of existence, Quark has become the... Read More
Scrapbooks are very popular these days. I think that almost... Read More
Handling character strings in Java is supported through two final... Read More
Since Version 8.0 Microsoft Business Solutions Great Plains & Great... Read More
Software |