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
cleaning service near Bannockburn ..There is many things more frustrating than surfing a website... Read More
Microsoft Business Solutions products: Great Plains, MS CRM, Navision, Axapta,... Read More
Cyberspace has opened up a new frontier with exciting possibilities... Read More
#5 All your hardware components like Printers, PCs etc come... Read More
Having from five to ten and more favorite screensavers is... Read More
New post-recession era has new features, which didn't exist in... Read More
Microsoft Business Solutions Small Business Manager is scaled down Great... Read More
Microsoft Business Solutions Great Plains is very generic accounting application... Read More
Spyware and malware are large problems for Internet users today... Read More
The purpose of one of our projects was MS Exchange... Read More
What is 'adware'?Adware is basically software or scripts that are... Read More
Although we don't know whether Microsoft ever envisioned such a... Read More
Microsoft PowerPoint has dramatically changed the way in which academic... Read More
Adware is a type of Spyware program that displays some... Read More
Microsoft Business Solutions ? Great Plains has captured the US... Read More
No matter how much you enjoy your favorite screensavers, sometimes... Read More
Are you one of those people that keeps track of... Read More
FTP stands for "file transfer protocol". FTP is basically a... Read More
Remember back in the days where screensavers were the coolest... Read More
Microsoft Great Plains and Microsoft Retail Management System (Microsoft RMS)... Read More
Formatting and reinstalling windows 98 is very easy if you... Read More
The world of small business accounting software can be a... Read More
Microsoft Great Plains and Microsoft Retail Management System (Microsoft RMS)... Read More
Microsoft Business Solutions Great Plains is Dexterity-written application and currently... Read More
We were recently faced with a decision: either to let... Read More
pet-friendly home cleaners Mundelein ..With so many Microsoft Windows related viruses, errors, and other... Read More
NOTE: Please take time to read on - it may... Read More
Most computer users use spreadsheets software such as Microsoft Excel... Read More
Microsoft Great Plains is main accounting / ERP application... Read More
Microsoft Business Solutions Navision is main ERP application for European,... Read More
Our opinion is based on our Microsoft Business Solutions Great... Read More
Microsoft Business Solutions Great Plains, former Great Plains Software Dynamics/eEnterprise... Read More
Spyware, what it is and what it does. Basically, spyware... Read More
Costs of fleet maintenance software can vary widely. It is... Read More
Now that spyware is the single most dangerous threat to... Read More
Well, even if the combination might look very unusual, we... Read More
Background: For many organizations like ours, the interim target of... Read More
It's no secret that software companies operate in a very... Read More
Lotus Domino/Notes ? Microsoft Great Plains tandem as ERP with... Read More
Microsoft Business Solutions Great Plains has many years of successful... Read More
The major reason I recommend getting your hands on real... Read More
Microsoft CRM customization techniques are very diversified and based on... Read More
Domino server is a buffer between the operation system and... Read More
Customer Relationship Management, abbreviated "CRM," is the term for a... Read More
Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More
Case study: A secretary using Corel WordPerfect 7 is often... Read More
Great Plains Inventory Management (IV) module gives your business a... Read More
Creating a new markup language.Introduction.General Reuse Markup Langauge, or GRML,... Read More
We've all seen the ads on TV for Netzero 3G.... Read More
In the real world a "fire wall" is a fireproof... Read More
Software |