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
maid service near Lake Forest ..How would you like to prevent spyware and adware from... Read More
Microsoft Great Plains has substantial mid-market share in the USA... Read More
Once a business idea is selected, it is highly recommended... Read More
This article illustrates the best practices to improve the performance... Read More
XML parser is a software module to read documents and... Read More
Software Engineering is the Systematic Approach for analysis design implementation... Read More
Microsoft Great Plains and Microsoft CRM become more and more... Read More
It is really interesting that a bug can create problem... Read More
You turn on your computer, and it doesn't look quite... Read More
RSS (Really Simple Syndication) is a way for a site... Read More
Great Plains Accounting, accounting package for mid-size and small companies... Read More
When reading an article where some term is used often,... Read More
Our hosted solution allow you to run your own search... Read More
Innovative Maintenance Systems (IMS) is one company that offers solutions... Read More
How to delete the user? This is the first problem... Read More
Collaboration SoftwareCollaboration Software, also known as group collaboration software or... Read More
The Internet is reshaping every form of communications medium, and... Read More
Great Plains Software Dynamics, Dynamics C/S+, eEnterprise were written on... Read More
If you have been running Windows XP for a couple... Read More
Microsoft Business Solutions Great Plains fits to majority of horizontal... Read More
Microsoft CRM was designed to be easily customizable. Microsoft CRM... Read More
Viruses and spyware usually show up on your computer one... Read More
Remember back in the days where screensavers were the coolest... Read More
Spyware, what it is and what it does. Basically, spyware... Read More
SOFTWARE PIRACY We regularly hear reports... Read More
top rated cleaning service Des Plaines ..There are many commands that are used in linux on... Read More
Professional services firm cuts costs and improves productivity with integrated... Read More
Follow the steps below to quickly design, generate, and deploy... Read More
XML parser is a software module to read documents and... Read More
Customer Relationship Management or CRM is a combination of enterprise... Read More
The major reason I recommend getting your hands on real... Read More
Microsoft Great Plains fits to majority of industries, in the... Read More
IBM Lotus Domino or Microsoft Exchange?The severe competition continues for... Read More
Small can be beautiful! Working with Knoppix for the past... Read More
Software development is a risky business.Many software developers are barely... Read More
Microsoft Great Plains is main Microsoft Business Solutions accounting package... Read More
Does Microsoft Have any Real Competition? Copyright (c) 2003 Gregory... Read More
Running Applications in Compatibility Mode With Windows XP, you can... Read More
Microsoft Business Solutions Great Plains was historically designed to serve... Read More
Usually workflow & messaging is realized in CRM and then... Read More
Usually, the easiest way to tell you have spyware is... Read More
In our small article we'll consider Microsoft Business Solutions Great... Read More
In 2004 Oracle, Inc. made its new step toward J2EE... Read More
Remember back in the days where screensavers were the coolest... Read More
Microsoft Great Plains is now standard mid-market ERP application, serving... Read More
There are so many different programs that clutter up your... Read More
OEComplete is a utility for managing the personal information of... Read More
Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More
Microsoft Business Solutions Great Plains has full-featured manufacturing set of... Read More
Internet worms. Is your PC infected?If your computer has become... Read More
Software |