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
apartment cleaning near Highland Park ..I like my software simple. If it's too complex or... Read More
Make-or-Break Factors in Success and ProfitabilityFor quick printers, estimating can... Read More
Most computer users use spreadsheets software such as Microsoft Excel... Read More
The research in the field of Natural Language Processing usually... Read More
Software development is a risky business.Many software developers are barely... Read More
Ad-Aware and Spybot are probably the two most well known... Read More
MSN messenger is a pretty cool invention. I mean I'm... Read More
Music downloads are off the charts! We're listening to digital... Read More
With the advent of 'Service Pack 2' for Windows XP... Read More
Our hosted solution allow you to run your own search... Read More
We've all seen the ads on TV for Netzero 3G.... Read More
This article is the first of a series of articles... Read More
Some introduction into Great Plains Software products, now Microsoft Business... Read More
Microsoft Great Plains, former Great Plains Software Dynamics, eEnterprise has... Read More
Navision Software was purchased by Microsoft and now it is... Read More
In the real world a "fire wall" is a fireproof... Read More
Microsoft Business Solutions Navision is main ERP application for European,... Read More
As we could imagine, if you are reading this article... Read More
Microsoft CRM has built-in conversion tool, however you should probably... Read More
The java programming language is becoming more and more popular... Read More
Microsoft Great Plains is one of the Microsoft Business Solutions... Read More
Here is some free software tools to help you build... Read More
In 2004 Oracle, Inc. made its new step toward J2EE... Read More
Handling character strings in Java is supported through two final... Read More
Is Photoshop CS2 worth the upgrade? You bet it is!... Read More
cleaning lady near Arlington Heights ..If you use Microsoft Outlook (or similar applications) for e-mailing,... Read More
Microsoft released Service Pack 2 (SP2) for the Windows XP... Read More
Remember nice and prosperous Clinton era? When you implemented innovative... Read More
ERP (Enterprise Resource Planning) Overview covers What is ERP, Brief... Read More
All your software is stored on a hard-drive. But how... Read More
Are you ready? SQL Server 2005, the next-generation data management... Read More
Microsoft bought Navision, Denmark based software development company, along with... Read More
Great Plains Inventory Management (IV) module gives your business a... Read More
If you've been using MySQL database to store your important... Read More
When you visit department stores and see that majority of... Read More
Sometimes your PC will start acting strange for no apparent... Read More
Need software to record your voice, streaming audio or musical... Read More
Microsoft Great Plains is now standard mid-market ERP application, serving... Read More
With so many Microsoft Windows related viruses, errors, and other... Read More
We were recently faced with a decision: either to let... Read More
Traditionally we were considering functionally rich systems, such as SAP,... Read More
Which Type of Shop Can Rely On A Home Built... Read More
This article is for advanced Microsoft CRM SDK C# developers.... Read More
Around the same time Microsoft made its move with .Net... Read More
You turn on your computer, and it doesn't look quite... Read More
Formatting and reinstalling windows 98 is very easy if you... Read More
I started using PIP (Picture It Publishing) Platinum 2002 right... Read More
Handling character strings in Java is supported through two final... Read More
There are plenty of articles out there about how to... Read More
Microsoft Business Solutions Great Plains is written in Great Plains... Read More
Software |